Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import pandas as pd
|
| 5 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
| 6 |
-
|
| 7 |
# --- Constants ---
|
| 8 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 9 |
|
|
|
|
| 1 |
+
|
| 2 |
+
try:
|
| 3 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
| 4 |
+
except ImportError:
|
| 5 |
+
print("⚠️ Installing smolagents from source...")
|
| 6 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "git+https://github.com/huggingface/smolagents.git"])
|
| 7 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
| 8 |
import os
|
| 9 |
+
|
| 10 |
import gradio as gr
|
| 11 |
import requests
|
| 12 |
import pandas as pd
|
|
|
|
|
|
|
| 13 |
# --- Constants ---
|
| 14 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 15 |
|