Mtchmann commited on
Commit
28802a2
Β·
verified Β·
1 Parent(s): bc033f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -22
app.py CHANGED
@@ -18,8 +18,7 @@ def get_all_questions():
18
 
19
  # --- Core Application Logic ---
20
  def run_and_submit_all(
21
- profile: gr.OAuthProfile | None, openai_api_key: str, tavily_api_key: str
22
- ):
23
  """
24
  Orchestrates the process of fetching GAIA tasks, running the agent, and submitting results.
25
 
@@ -45,17 +44,6 @@ def run_and_submit_all(
45
  yield f"### ❌ Error during Hugging Face authentication: {e}"
46
  return
47
 
48
- # 3. Validate API Keys
49
- if not openai_api_key or not tavily_api_key:
50
- yield "### ❌ Error: OpenAI and Tavily API keys are required. Please enter them above."
51
- return
52
-
53
- # 4. Set API Keys as Environment Variables for the Agent
54
- # This makes the keys available to the `solve` function when it's called.
55
- os.environ["OPENAI_API_KEY"] = openai_api_key
56
- os.environ["TAVILY_API_KEY"] = tavily_api_key
57
- yield "### πŸ”‘ API keys successfully set for this session."
58
- yield "---"
59
 
60
  # 5. Fetch and Process Questions
61
  try:
@@ -117,14 +105,6 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
117
  login_button = gr.LoginButton(value="Login with Hugging Face πŸ€—")
118
  run_button = gr.Button("Run and Submit All Tasks", variant="primary")
119
 
120
- with gr.Accordion("API Keys (Required)", open=False):
121
- gr.Markdown("Your keys are used only for this session and are not stored.")
122
- openai_api_key_box = gr.Textbox(
123
- label="OpenAI API Key", type="password", interactive=True
124
- )
125
- tavily_api_key_box = gr.Textbox(
126
- label="Tavily API Key", type="password", interactive=True
127
- )
128
 
129
  gr.Markdown("---")
130
  gr.Markdown("### πŸ“ Live Output")
@@ -133,7 +113,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
133
  # Connect the "Run" button to the main logic function
134
  run_button.click(
135
  fn=run_and_submit_all,
136
- inputs=[login_button, openai_api_key_box, tavily_api_key_box],
137
  outputs=[output_textbox],
138
  )
139
 
 
18
 
19
  # --- Core Application Logic ---
20
  def run_and_submit_all(
21
+ profile: gr.OAuthProfile | None):
 
22
  """
23
  Orchestrates the process of fetching GAIA tasks, running the agent, and submitting results.
24
 
 
44
  yield f"### ❌ Error during Hugging Face authentication: {e}"
45
  return
46
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  # 5. Fetch and Process Questions
49
  try:
 
105
  login_button = gr.LoginButton(value="Login with Hugging Face πŸ€—")
106
  run_button = gr.Button("Run and Submit All Tasks", variant="primary")
107
 
 
 
 
 
 
 
 
 
108
 
109
  gr.Markdown("---")
110
  gr.Markdown("### πŸ“ Live Output")
 
113
  # Connect the "Run" button to the main logic function
114
  run_button.click(
115
  fn=run_and_submit_all,
116
+ inputs=[login_button],
117
  outputs=[output_textbox],
118
  )
119