Spaces:
Sleeping
Sleeping
Commit ·
b3918ea
1
Parent(s): 34e8d3e
change code
Browse files
app.py
CHANGED
|
@@ -15,9 +15,12 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 15 |
class BasicAgent:
|
| 16 |
def __init__(self):
|
| 17 |
print("BasicAgent initialized.")
|
|
|
|
|
|
|
|
|
|
| 18 |
model = OpenAIServerModel(
|
| 19 |
model_id=os.getenv("MODEL_ID"),
|
| 20 |
-
api_key=
|
| 21 |
api_base=os.getenv("API_BASE"),
|
| 22 |
)
|
| 23 |
self.agent = ToolCallingAgent(tools=[DuckDuckGoSearchTool()], model=model)
|
|
@@ -150,6 +153,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 150 |
|
| 151 |
|
| 152 |
# --- Build Gradio Interface using Blocks ---
|
|
|
|
|
|
|
| 153 |
with gr.Blocks() as demo:
|
| 154 |
gr.Markdown("# Basic Agent Evaluation Runner")
|
| 155 |
gr.Markdown(
|
|
@@ -169,6 +174,8 @@ with gr.Blocks() as demo:
|
|
| 169 |
|
| 170 |
gr.LoginButton()
|
| 171 |
|
|
|
|
|
|
|
| 172 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 173 |
|
| 174 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|
|
|
|
| 15 |
class BasicAgent:
|
| 16 |
def __init__(self):
|
| 17 |
print("BasicAgent initialized.")
|
| 18 |
+
global secret_key
|
| 19 |
+
if secret_key is None:
|
| 20 |
+
raise ValueError("Secret key is not set. Please provide a valid secret key.")
|
| 21 |
model = OpenAIServerModel(
|
| 22 |
model_id=os.getenv("MODEL_ID"),
|
| 23 |
+
api_key=secret_key,
|
| 24 |
api_base=os.getenv("API_BASE"),
|
| 25 |
)
|
| 26 |
self.agent = ToolCallingAgent(tools=[DuckDuckGoSearchTool()], model=model)
|
|
|
|
| 153 |
|
| 154 |
|
| 155 |
# --- Build Gradio Interface using Blocks ---
|
| 156 |
+
secret_key = None
|
| 157 |
+
|
| 158 |
with gr.Blocks() as demo:
|
| 159 |
gr.Markdown("# Basic Agent Evaluation Runner")
|
| 160 |
gr.Markdown(
|
|
|
|
| 174 |
|
| 175 |
gr.LoginButton()
|
| 176 |
|
| 177 |
+
secret_key = gr.Textbox(label="Secret Key", lines=1, interactive=True)
|
| 178 |
+
|
| 179 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 180 |
|
| 181 |
status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
|