Spaces:
Sleeping
Sleeping
Update app.py
Browse files1234567891011import osimport gradio as grimport requestsimport pandas as pd # You might not need this if smolagents handles data# import subprocess # REMOVE if using smolagents, this was for the previous workaround# import sys # REMOVE if using smolagents, this was for the previous workaroundfrom agent import GaiaAgentDEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"12345678910111213141516171819202122232425262728import osimport gradio as grimport requestsimport pandas as pdimport subprocessimport sys # Import sys# --- START: Force DDGS installation workaround ---try:# Check if duckduckgo_search (provided by ddgs) can be importedimport duckduckgo_searchprint("duckduckgo_search (via ddgs) is already installed.")except ImportError:print("duckduckgo_search not found. Attempting to install ddgs...")try:# Use ddgs as it's the updated package namesubprocess.check_call([sys.executable, "-m", "pip", "install", "ddgs>=4.0.0"])print("ddgs installed successfully.")except Exception as e:print(f"Failed to install ddgs: {e}")# Critical error, re-raise to stop startup if essential dependency failsraise RuntimeError(f"CRITICAL: Failed to install ddgs: {e}")# --- END: Force DDGS installation workaround ---from agent import GaiaAgent # This line should now run after ddgs is confirmed installedDEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
app.py+21-4