Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,7 +104,7 @@ def python_handler(filepath: str) -> str:
|
|
| 104 |
["python", filepath],
|
| 105 |
capture_output=True,
|
| 106 |
text=True,
|
| 107 |
-
timeout=
|
| 108 |
)
|
| 109 |
return result.stdout.strip() if result.returncode == 0 else result.stderr
|
| 110 |
except Exception as e:
|
|
@@ -365,8 +365,9 @@ def general_agent(state: AgentState):
|
|
| 365 |
INPUT FORMAT:
|
| 366 |
- A question (text) that you should answer correctly.
|
| 367 |
OUTPUT FORMAT:
|
| 368 |
-
Output **ONLY** the final answer dictated by the user's question and
|
| 369 |
-
**
|
|
|
|
| 370 |
If the question tells you to output 'How many ...' you **MUST** response with **only** a single numeral and absolutely nothing else (no punctuation, no sentence, no units).
|
| 371 |
If the question tells you to output 'What number ...' you **MUST** response with **only** a single numeral and absolutely nothing else (no punctuation, no sentence, no units).
|
| 372 |
If the question tells you to output 'Who did ...' you **MUST** response with **only** the full name unless the question directs you otherwise and absolutely nothing else (no punctuation, no sentence, no units).
|
|
@@ -588,8 +589,6 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 588 |
Fetches all questions, runs the FinalAgent on them, submits all answers,
|
| 589 |
and displays the results.
|
| 590 |
"""
|
| 591 |
-
# --- Determine HF Space Runtime URL and Repo URL ---
|
| 592 |
-
space_id = os.getenv("TheZakynthian/Final_Assignment_Template") # Get the SPACE_ID for sending link to the code
|
| 593 |
|
| 594 |
if profile:
|
| 595 |
username= f"{profile.username}"
|
|
@@ -609,7 +608,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 609 |
print(f"Error instantiating agent: {e}")
|
| 610 |
return f"Error initializing agent: {e}", None
|
| 611 |
# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
|
| 612 |
-
agent_code = f"https://huggingface.co/spaces/
|
| 613 |
|
| 614 |
# 2. Fetch Questions
|
| 615 |
print(f"Fetching questions from: {questions_url}")
|
|
|
|
| 104 |
["python", filepath],
|
| 105 |
capture_output=True,
|
| 106 |
text=True,
|
| 107 |
+
timeout=30 # Safety
|
| 108 |
)
|
| 109 |
return result.stdout.strip() if result.returncode == 0 else result.stderr
|
| 110 |
except Exception as e:
|
|
|
|
| 365 |
INPUT FORMAT:
|
| 366 |
- A question (text) that you should answer correctly.
|
| 367 |
OUTPUT FORMAT:
|
| 368 |
+
Output **ONLY** the final answer dictated by the user's question and only that.
|
| 369 |
+
**NEVER** wrap your final answer like this: <sentence> answer </sentence>.
|
| 370 |
+
<**IMPORTANT**> If the question contains a youtube link (https://www.youtube.com/watch?...) and **ONLY THEN** output this "Don't know".
|
| 371 |
If the question tells you to output 'How many ...' you **MUST** response with **only** a single numeral and absolutely nothing else (no punctuation, no sentence, no units).
|
| 372 |
If the question tells you to output 'What number ...' you **MUST** response with **only** a single numeral and absolutely nothing else (no punctuation, no sentence, no units).
|
| 373 |
If the question tells you to output 'Who did ...' you **MUST** response with **only** the full name unless the question directs you otherwise and absolutely nothing else (no punctuation, no sentence, no units).
|
|
|
|
| 589 |
Fetches all questions, runs the FinalAgent on them, submits all answers,
|
| 590 |
and displays the results.
|
| 591 |
"""
|
|
|
|
|
|
|
| 592 |
|
| 593 |
if profile:
|
| 594 |
username= f"{profile.username}"
|
|
|
|
| 608 |
print(f"Error instantiating agent: {e}")
|
| 609 |
return f"Error initializing agent: {e}", None
|
| 610 |
# In the case of an app running as a hugging Face space, this link points toward your codebase ( usefull for others so please keep it public)
|
| 611 |
+
agent_code = f"https://huggingface.co/spaces/TheZakynthian/Final_Assignment_Template/tree/main"
|
| 612 |
|
| 613 |
# 2. Fetch Questions
|
| 614 |
print(f"Fetching questions from: {questions_url}")
|