kuzumab commited on
Commit
f2905ee
·
verified ·
1 Parent(s): c87ddc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -179,7 +179,24 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
179
  api_url = DEFAULT_API_URL
180
  questions_url = f"{api_url}/questions"
181
  submit_url = f"{api_url}/submit"
 
 
 
 
 
 
 
182
 
 
 
 
 
 
 
 
 
 
 
183
 
184
  # 1. Instantiate Agent ( modify this part to create your agent)
185
  try:
@@ -313,24 +330,7 @@ with gr.Blocks() as demo:
313
  fn=run_and_submit_all,
314
  outputs=[status_output, results_table]
315
  )
316
- from opentelemetry.sdk.trace import TracerProvider
317
- from openinference.instrumentation.smolagents import SmolagentsInstrumentor
318
- from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
319
- from opentelemetry.sdk.trace.export import SimpleSpanProcessor
320
-
321
- # Create a TracerProvider for OpenTelemetry
322
- trace_provider = TracerProvider()
323
-
324
- # Add a SimpleSpanProcessor with the OTLPSpanExporter to send traces
325
- trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
326
-
327
- # Set the global default tracer provider
328
- from opentelemetry import trace
329
- trace.set_tracer_provider(trace_provider)
330
- tracer = trace.get_tracer(__name__)
331
-
332
- # Instrument smolagents with the configured provider
333
- SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
334
  if __name__ == "__main__":
335
 
336
  print("\n" + "-"*30 + " App Starting " + "-"*30)
 
179
  api_url = DEFAULT_API_URL
180
  questions_url = f"{api_url}/questions"
181
  submit_url = f"{api_url}/submit"
182
+ from opentelemetry.sdk.trace import TracerProvider
183
+ from openinference.instrumentation.smolagents import SmolagentsInstrumentor
184
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
185
+ from opentelemetry.sdk.trace.export import SimpleSpanProcessor
186
+
187
+ # Create a TracerProvider for OpenTelemetry
188
+ trace_provider = TracerProvider()
189
 
190
+ # Add a SimpleSpanProcessor with the OTLPSpanExporter to send traces
191
+ trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
192
+
193
+ # Set the global default tracer provider
194
+ from opentelemetry import trace
195
+ trace.set_tracer_provider(trace_provider)
196
+ tracer = trace.get_tracer(__name__)
197
+
198
+ # Instrument smolagents with the configured provider
199
+ SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
200
 
201
  # 1. Instantiate Agent ( modify this part to create your agent)
202
  try:
 
330
  fn=run_and_submit_all,
331
  outputs=[status_output, results_table]
332
  )
333
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  if __name__ == "__main__":
335
 
336
  print("\n" + "-"*30 + " App Starting " + "-"*30)