Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool,
|
7 |
# (Keep Constants as is)
|
8 |
# --- Constants ---
|
9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
@@ -16,7 +16,9 @@ class BasicAgent:
|
|
16 |
print("BasicAgent initialized.")
|
17 |
# Initialize the model
|
18 |
#model = HfApiModel()
|
19 |
-
|
|
|
|
|
20 |
# Initialize the search tool
|
21 |
search_tool = DuckDuckGoSearchTool()
|
22 |
# Initialize Agent
|
@@ -164,7 +166,6 @@ with gr.Blocks() as demo:
|
|
164 |
**Disclaimers:**
|
165 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
166 |
This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
|
167 |
-
Please note that this version requires an OpenAI Key to run.
|
168 |
"""
|
169 |
)
|
170 |
|
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
|
7 |
# (Keep Constants as is)
|
8 |
# --- Constants ---
|
9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
16 |
print("BasicAgent initialized.")
|
17 |
# Initialize the model
|
18 |
#model = HfApiModel()
|
19 |
+
api_token = os.getenv("HF_API_TOKEN") # get your token
|
20 |
+
model = HfApiModel(model_id="Alibaba-NLP/gte-Qwen1.5-7B-instruct", api_token=api_token)
|
21 |
+
|
22 |
# Initialize the search tool
|
23 |
search_tool = DuckDuckGoSearchTool()
|
24 |
# Initialize Agent
|
|
|
166 |
**Disclaimers:**
|
167 |
Once clicking on the "submit button, it can take quite some time ( this is the time for the agent to go through all the questions).
|
168 |
This space provides a basic setup and is intentionally sub-optimal to encourage you to develop your own, more robust solution. For instance for the delay process of the submit button, a solution could be to cache the answers and submit in a seperate action or even to answer the questions in async.
|
|
|
169 |
"""
|
170 |
)
|
171 |
|