Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ import gradio as gr
|
|
| 19 |
import pandas as pd
|
| 20 |
import requests
|
| 21 |
|
|
|
|
| 22 |
from agent import BasicAgent, check_model
|
| 23 |
|
| 24 |
try: # ZeroGPU checks for one @spaces.GPU function at startup
|
|
@@ -62,13 +63,13 @@ def run_and_submit_all(profile: gr.OAuthProfile | None, use_cache: bool):
|
|
| 62 |
except Exception as e:
|
| 63 |
return f"Error creating the agent: {e}", None
|
| 64 |
|
| 65 |
-
# 0. check the
|
| 66 |
problem = check_model()
|
| 67 |
if problem:
|
| 68 |
-
return ("
|
| 69 |
f"{problem[:800]}\n\n"
|
| 70 |
-
"Usual causes: daily free
|
| 71 |
-
"
|
| 72 |
|
| 73 |
# 1. fetch questions
|
| 74 |
try:
|
|
@@ -122,6 +123,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None, use_cache: bool):
|
|
| 122 |
r.raise_for_status()
|
| 123 |
d = r.json()
|
| 124 |
status = (
|
|
|
|
| 125 |
f"Submission successful in {time.time() - start:.0f}s\n"
|
| 126 |
f"User: {d.get('username')}\n"
|
| 127 |
f"Score: {d.get('score', 'N/A')}% "
|
|
|
|
| 19 |
import pandas as pd
|
| 20 |
import requests
|
| 21 |
|
| 22 |
+
import agent as agent_module
|
| 23 |
from agent import BasicAgent, check_model
|
| 24 |
|
| 25 |
try: # ZeroGPU checks for one @spaces.GPU function at startup
|
|
|
|
| 63 |
except Exception as e:
|
| 64 |
return f"Error creating the agent: {e}", None
|
| 65 |
|
| 66 |
+
# 0. check the API key and quota with one tiny call before spending time on 20 questions
|
| 67 |
problem = check_model()
|
| 68 |
if problem:
|
| 69 |
+
return ("Test call to the model failed, so nothing was run or submitted.\n"
|
| 70 |
f"{problem[:800]}\n\n"
|
| 71 |
+
"Usual causes: Groq's daily free limit used up (wait until tomorrow), a wrong or missing "
|
| 72 |
+
"GROQ_API_KEY secret, or a model name that changed (edit MODEL_ID in agent.py)."), None
|
| 73 |
|
| 74 |
# 1. fetch questions
|
| 75 |
try:
|
|
|
|
| 123 |
r.raise_for_status()
|
| 124 |
d = r.json()
|
| 125 |
status = (
|
| 126 |
+
f"Model: {agent_module.MODEL_ID}\n"
|
| 127 |
f"Submission successful in {time.time() - start:.0f}s\n"
|
| 128 |
f"User: {d.get('username')}\n"
|
| 129 |
f"Score: {d.get('score', 'N/A')}% "
|