Commit ·
f5bf6b6
1
Parent(s): 8fcab88
Update model, fix file handling, and return string
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ class BasicAgent:
|
|
| 27 |
raise ValueError("GEMINI_API_KEY not set in environment variables.")
|
| 28 |
|
| 29 |
self.model = GoogleGenAI(
|
| 30 |
-
model="gemini-2.0-flash",
|
| 31 |
api_key=gemini_api_key
|
| 32 |
)
|
| 33 |
|
|
@@ -56,7 +56,7 @@ class BasicAgent:
|
|
| 56 |
request = ChatMessage(role="user", blocks=blocks)
|
| 57 |
response = await self.agent.run(request)
|
| 58 |
print(f"Agent returning fixed answer: {response}")
|
| 59 |
-
return response
|
| 60 |
|
| 61 |
def reversed_string(a_string: str):
|
| 62 |
"""Reverses a string"""
|
|
@@ -84,7 +84,6 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 84 |
api_url = DEFAULT_API_URL
|
| 85 |
questions_url = f"{api_url}/questions"
|
| 86 |
submit_url = f"{api_url}/submit"
|
| 87 |
-
download_url = f"{api_url}/files/"
|
| 88 |
|
| 89 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 90 |
try:
|
|
@@ -131,8 +130,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 131 |
try:
|
| 132 |
messages = [question_text]
|
| 133 |
if file_name:
|
| 134 |
-
|
| 135 |
-
messages.append(file_url)
|
| 136 |
submitted_answer = asyncio.run(agent(messages))
|
| 137 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 138 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
|
| 27 |
raise ValueError("GEMINI_API_KEY not set in environment variables.")
|
| 28 |
|
| 29 |
self.model = GoogleGenAI(
|
| 30 |
+
model="gemini-2.0-flash-lite",
|
| 31 |
api_key=gemini_api_key
|
| 32 |
)
|
| 33 |
|
|
|
|
| 56 |
request = ChatMessage(role="user", blocks=blocks)
|
| 57 |
response = await self.agent.run(request)
|
| 58 |
print(f"Agent returning fixed answer: {response}")
|
| 59 |
+
return str(response)
|
| 60 |
|
| 61 |
def reversed_string(a_string: str):
|
| 62 |
"""Reverses a string"""
|
|
|
|
| 84 |
api_url = DEFAULT_API_URL
|
| 85 |
questions_url = f"{api_url}/questions"
|
| 86 |
submit_url = f"{api_url}/submit"
|
|
|
|
| 87 |
|
| 88 |
# 1. Instantiate Agent ( modify this part to create your agent)
|
| 89 |
try:
|
|
|
|
| 130 |
try:
|
| 131 |
messages = [question_text]
|
| 132 |
if file_name:
|
| 133 |
+
messages.append(file_name)
|
|
|
|
| 134 |
submitted_answer = asyncio.run(agent(messages))
|
| 135 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 136 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|