pulkitme
commited on
Commit
·
d9b21dc
1
Parent(s):
1452216
gemini 2 flash as first agent
Browse files- app.py +8 -13
- requirements.txt +1 -1
app.py
CHANGED
@@ -4,9 +4,9 @@ import requests
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
|
7 |
-
from
|
8 |
|
9 |
-
client =
|
10 |
# (Keep Constants as is)
|
11 |
# --- Constants ---
|
12 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
@@ -20,18 +20,13 @@ class BasicAgent:
|
|
20 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
21 |
|
22 |
|
23 |
-
response = client.
|
24 |
-
model="
|
25 |
-
|
26 |
-
|
27 |
-
{"role": "user", "content": question},
|
28 |
-
],
|
29 |
-
stream=False
|
30 |
-
)
|
31 |
-
deepseek_answer = response.choices[0].message.content
|
32 |
#fixed_answer = "This is a default answer."
|
33 |
-
print(f"Agent returning fixed answer: {
|
34 |
-
return
|
35 |
|
36 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
37 |
"""
|
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
|
7 |
+
from google import genai
|
8 |
|
9 |
+
client = genai.Client(api_key=os.getenv("API_KEY"))
|
10 |
# (Keep Constants as is)
|
11 |
# --- Constants ---
|
12 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
20 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
21 |
|
22 |
|
23 |
+
response = client.models.generate_content(
|
24 |
+
model="gemini-2.0-flash", contents=question
|
25 |
+
)
|
26 |
+
gemini_flash_answer = response.text
|
|
|
|
|
|
|
|
|
|
|
27 |
#fixed_answer = "This is a default answer."
|
28 |
+
print(f"Agent returning fixed answer: {gemini_flash_answer}")
|
29 |
+
return gemini_flash_answer
|
30 |
|
31 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
32 |
"""
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
gradio
|
2 |
requests
|
3 |
-
|
|
|
1 |
gradio
|
2 |
requests
|
3 |
+
google-genai
|