Update app.py
Browse files
app.py
CHANGED
@@ -180,24 +180,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
180 |
questions_url = f"{api_url}/questions"
|
181 |
submit_url = f"{api_url}/submit"
|
182 |
|
183 |
-
from opentelemetry.sdk.trace import TracerProvider
|
184 |
-
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
185 |
-
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
186 |
-
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
|
187 |
-
|
188 |
-
# Create a TracerProvider for OpenTelemetry
|
189 |
-
trace_provider = TracerProvider()
|
190 |
|
191 |
-
# Add a SimpleSpanProcessor with the OTLPSpanExporter to send traces
|
192 |
-
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
|
193 |
-
|
194 |
-
# Set the global default tracer provider
|
195 |
-
from opentelemetry import trace
|
196 |
-
trace.set_tracer_provider(trace_provider)
|
197 |
-
tracer = trace.get_tracer(__name__)
|
198 |
-
|
199 |
-
# Instrument smolagents with the configured provider
|
200 |
-
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
|
201 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
202 |
try:
|
203 |
agent = BasicAgent()
|
@@ -330,8 +313,26 @@ with gr.Blocks() as demo:
|
|
330 |
fn=run_and_submit_all,
|
331 |
outputs=[status_output, results_table]
|
332 |
)
|
333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
if __name__ == "__main__":
|
|
|
335 |
print("\n" + "-"*30 + " App Starting " + "-"*30)
|
336 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
337 |
space_host_startup = os.getenv("SPACE_HOST")
|
|
|
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:
|
186 |
agent = BasicAgent()
|
|
|
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)
|
337 |
# Check for SPACE_HOST and SPACE_ID at startup for information
|
338 |
space_host_startup = os.getenv("SPACE_HOST")
|