Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ import pandas as pd
|
|
| 5 |
import gradio as gr
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, LiteLLMModel
|
| 7 |
|
| 8 |
-
DEFAULT_API_URL = "
|
| 9 |
MODEL_ID = "huggingface/Qwen/Qwen2.5-Coder-32B-Instruct"
|
| 10 |
|
| 11 |
def create_agent(token: str):
|
|
@@ -50,7 +50,6 @@ def solve_question(agent, question: str) -> str:
|
|
| 50 |
parts = ans.split("```")
|
| 51 |
for part in parts:
|
| 52 |
part_clean = part.strip()
|
| 53 |
-
# Убираем языковые маркеры вроде json, python и т.д.
|
| 54 |
if part_clean.startswith(("json", "python", "text")):
|
| 55 |
part_clean = part_clean.split("\n", 1)[-1].strip()
|
| 56 |
if part_clean:
|
|
@@ -94,7 +93,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 94 |
yield f"Failed to initialize agent: {e}", None
|
| 95 |
return
|
| 96 |
|
| 97 |
-
agent_code = f"
|
| 98 |
|
| 99 |
try:
|
| 100 |
res = requests.get(f"{DEFAULT_API_URL}/questions", timeout=15)
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, LiteLLMModel
|
| 7 |
|
| 8 |
+
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 9 |
MODEL_ID = "huggingface/Qwen/Qwen2.5-Coder-32B-Instruct"
|
| 10 |
|
| 11 |
def create_agent(token: str):
|
|
|
|
| 50 |
parts = ans.split("```")
|
| 51 |
for part in parts:
|
| 52 |
part_clean = part.strip()
|
|
|
|
| 53 |
if part_clean.startswith(("json", "python", "text")):
|
| 54 |
part_clean = part_clean.split("\n", 1)[-1].strip()
|
| 55 |
if part_clean:
|
|
|
|
| 93 |
yield f"Failed to initialize agent: {e}", None
|
| 94 |
return
|
| 95 |
|
| 96 |
+
agent_code = f"https://huggingface.co/spaces/{space_id}/tree/main" if space_id else "https://huggingface.co"
|
| 97 |
|
| 98 |
try:
|
| 99 |
res = requests.get(f"{DEFAULT_API_URL}/questions", timeout=15)
|