Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ ANSWER_CACHE = {}
|
|
| 15 |
# --- Basic Agent Definition ---
|
| 16 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 17 |
|
| 18 |
-
class
|
| 19 |
def __init__(self):
|
| 20 |
print("Initializing Gemini Agent...")
|
| 21 |
api_key = os.getenv("GOOGLE_API_KEY")
|
|
@@ -50,7 +50,7 @@ class SuperAgent:
|
|
| 50 |
@spaces.GPU
|
| 51 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 52 |
"""
|
| 53 |
-
Fetches all questions, runs the
|
| 54 |
caches the answers, submits all answers, and displays the results.
|
| 55 |
"""
|
| 56 |
# --- Determine HF Space Runtime URL and Repo URL ---
|
|
@@ -69,7 +69,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 69 |
|
| 70 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 71 |
try:
|
| 72 |
-
agent =
|
| 73 |
except Exception as e:
|
| 74 |
print(f"Error instantiating agent: {e}")
|
| 75 |
return f"Error initializing agent: {e}", None
|
|
|
|
| 15 |
# --- Basic Agent Definition ---
|
| 16 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 17 |
|
| 18 |
+
class GeminiAgent:
|
| 19 |
def __init__(self):
|
| 20 |
print("Initializing Gemini Agent...")
|
| 21 |
api_key = os.getenv("GOOGLE_API_KEY")
|
|
|
|
| 50 |
@spaces.GPU
|
| 51 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 52 |
"""
|
| 53 |
+
Fetches all questions, runs the GeminiAgent on them asynchronously,
|
| 54 |
caches the answers, submits all answers, and displays the results.
|
| 55 |
"""
|
| 56 |
# --- Determine HF Space Runtime URL and Repo URL ---
|
|
|
|
| 69 |
|
| 70 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 71 |
try:
|
| 72 |
+
agent = GeminiAgent()
|
| 73 |
except Exception as e:
|
| 74 |
print(f"Error instantiating agent: {e}")
|
| 75 |
return f"Error initializing agent: {e}", None
|