Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,28 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
-
import pandas as pd
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
from agent import GaiaAgent
|
9 |
|
10 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
11 |
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import requests
|
4 |
+
import pandas as pd
|
5 |
+
import subprocess
|
6 |
+
import sys # Import sys
|
7 |
+
|
8 |
+
# --- START: Force DDGS installation workaround ---
|
9 |
+
try:
|
10 |
+
# Check if duckduckgo_search (provided by ddgs) can be imported
|
11 |
+
import duckduckgo_search
|
12 |
+
print("duckduckgo_search (via ddgs) is already installed.")
|
13 |
+
except ImportError:
|
14 |
+
print("duckduckgo_search not found. Attempting to install ddgs...")
|
15 |
+
try:
|
16 |
+
# Use ddgs as it's the updated package name
|
17 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "ddgs>=4.0.0"])
|
18 |
+
print("ddgs installed successfully.")
|
19 |
+
except Exception as e:
|
20 |
+
print(f"Failed to install ddgs: {e}")
|
21 |
+
# Critical error, re-raise to stop startup if essential dependency fails
|
22 |
+
raise RuntimeError(f"CRITICAL: Failed to install ddgs: {e}")
|
23 |
+
# --- END: Force DDGS installation workaround ---
|
24 |
|
25 |
+
from agent import GaiaAgent # This line should now run after ddgs is confirmed installed
|
26 |
|
27 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
28 |
|