Patched the event loop
Browse files
app.py
CHANGED
@@ -6,6 +6,8 @@ from opentelemetry import trace
|
|
6 |
from evaluator import Evaluator
|
7 |
from runner import Runner
|
8 |
from settings import Settings
|
|
|
|
|
9 |
import os
|
10 |
import pandas as pd
|
11 |
import gradio as gr
|
@@ -46,7 +48,11 @@ def run_one(profile: gr.OAuthProfile | None) -> pd.DataFrame:
|
|
46 |
if not user_logged_in(profile):
|
47 |
return LOGIN_MESSAGE, EMPTY_RESULTS_TABLE
|
48 |
questions = [evaluator.get_one_question()]
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
|
51 |
def run_all(profile: gr.OAuthProfile | None) -> pd.DataFrame:
|
52 |
if not user_logged_in(profile):
|
|
|
6 |
from evaluator import Evaluator
|
7 |
from runner import Runner
|
8 |
from settings import Settings
|
9 |
+
import asyncio
|
10 |
+
import nest_asyncio
|
11 |
import os
|
12 |
import pandas as pd
|
13 |
import gradio as gr
|
|
|
48 |
if not user_logged_in(profile):
|
49 |
return LOGIN_MESSAGE, EMPTY_RESULTS_TABLE
|
50 |
questions = [evaluator.get_one_question()]
|
51 |
+
# Apply nest_asyncio to patch the event loop
|
52 |
+
nest_asyncio.apply()
|
53 |
+
|
54 |
+
# Now, call run_agent within an event loop
|
55 |
+
results_df = asyncio.run(runner.run_agent(questions))
|
56 |
|
57 |
def run_all(profile: gr.OAuthProfile | None) -> pd.DataFrame:
|
58 |
if not user_logged_in(profile):
|