Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,7 +71,7 @@ class SmartAgent:
|
|
| 71 |
if not self.api_key:
|
| 72 |
raise ValueError("GEMINI_API_KEY environment variable not set!")
|
| 73 |
# Gemini 1.5 Flash - FREE tier: 1500 requests/day, 1M tokens/min
|
| 74 |
-
self.api_url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.
|
| 75 |
print("SmartAgent initialized with Gemini 1.5 Flash (FREE - 1500 req/day)")
|
| 76 |
|
| 77 |
def call_llm(self, prompt: str) -> str:
|
|
@@ -199,7 +199,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 199 |
except Exception as e:
|
| 200 |
print(f"Error on task {task_id}: {e}")
|
| 201 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"ERROR: {e}"})
|
| 202 |
-
import time; time.sleep(
|
| 203 |
|
| 204 |
if not answers_payload:
|
| 205 |
return "Agent did not produce any answers.", pd.DataFrame(results_log)
|
|
|
|
| 71 |
if not self.api_key:
|
| 72 |
raise ValueError("GEMINI_API_KEY environment variable not set!")
|
| 73 |
# Gemini 1.5 Flash - FREE tier: 1500 requests/day, 1M tokens/min
|
| 74 |
+
self.api_url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite-preview-06-17:generateContent?key={self.api_key}"
|
| 75 |
print("SmartAgent initialized with Gemini 1.5 Flash (FREE - 1500 req/day)")
|
| 76 |
|
| 77 |
def call_llm(self, prompt: str) -> str:
|
|
|
|
| 199 |
except Exception as e:
|
| 200 |
print(f"Error on task {task_id}: {e}")
|
| 201 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"ERROR: {e}"})
|
| 202 |
+
import time; time.sleep(7) # avoid rate limiting (free tier: 15 req/min)
|
| 203 |
|
| 204 |
if not answers_payload:
|
| 205 |
return "Agent did not produce any answers.", pd.DataFrame(results_log)
|