CultriX commited on
Commit
635d4f4
·
1 Parent(s): f2f8887
__pycache__/run.cpython-312.pyc CHANGED
Binary files a/__pycache__/run.cpython-312.pyc and b/__pycache__/run.cpython-312.pyc differ
 
app.py CHANGED
@@ -97,30 +97,40 @@ def launch_interface():
97
  gr.Markdown("# SmolAgent - Intelligent AI with Web Tools")
98
 
99
  with gr.Row():
100
- with gr.Column():
101
- question = gr.Textbox(label="Your Question", lines=3)
102
- model_id = gr.Textbox(label="Model ID", value="gpt-4.1-nano")
103
- hf_token = gr.Textbox(label="HF Token", type="password", value=os.getenv("HF_TOKEN", ""))
104
- openai_api_key = gr.Textbox(label="OpenAI API Key", type="password", value=os.getenv("OPENAI_API_KEY", ""))
105
- api_endpoint = gr.Textbox(label="API Endpoint", value=os.getenv("API_ENDPOINT", "https://api.openai.com/v1"))
106
- use_custom_endpoint = gr.Checkbox(label="Use Custom API Endpoint")
107
- custom_api_endpoint = gr.Textbox(label="Custom API URL", visible=False)
108
- custom_api_key = gr.Textbox(label="Custom API Key", type="password", visible=False)
109
- serpapi_key = gr.Textbox(label="SerpAPI Key", type="password", value=os.getenv("SERPAPI_API_KEY", ""))
110
- search_provider = gr.Dropdown(choices=["serper", "searxng"], value="searxng", label="Search Provider")
111
- search_api_key = gr.Textbox(label="Search Provider API Key", type="password", visible=True)
112
- custom_search_url = gr.Textbox(label="Custom SearxNG URL", value="https://search.endorisk.nl/search", visible=True)
113
- submit_btn = gr.Button("Submit")
114
-
115
- with gr.Column():
 
 
 
 
 
 
 
 
116
  output = gr.Markdown(label="Live Agent Output")
117
  final = gr.Textbox(label="Final Answer", interactive=False)
118
  copy_btn = gr.Button("Copy Final Answer")
119
 
120
  def update_visibility(provider):
 
 
121
  return {
122
- custom_search_url: gr.update(visible=(provider == "searxng")),
123
- search_api_key: gr.update(visible=(provider == "searxng"))
124
  }
125
 
126
  def update_custom_fields(checked):
@@ -139,15 +149,17 @@ def launch_interface():
139
  show_progress=True
140
  )
141
 
 
142
  copy_btn.click(
143
- fn=lambda txt: gr.Textbox.update(value=txt),
144
  inputs=final,
145
- outputs=final,
146
- show_progress=False
147
  )
 
148
 
149
  print("[DEBUG] Launching updated Gradio interface")
150
  demo.launch()
151
 
152
  if __name__ == "__main__":
153
- launch_interface()
 
97
  gr.Markdown("# SmolAgent - Intelligent AI with Web Tools")
98
 
99
  with gr.Row():
100
+ with gr.Column(scale=1):
101
+ question = gr.Textbox(label="Your Question", lines=3, placeholder="Enter your question or task for the AI agent...")
102
+ model_id = gr.Textbox(label="Model ID", value="gpt-4.1-nano", placeholder="e.g., gpt-4, claude-3-opus-20240229")
103
+
104
+ with gr.Accordion("API Configuration", open=False):
105
+ hf_token = gr.Textbox(label="Hugging Face Token (Optional)", type="password", value=os.getenv("HF_TOKEN", ""), placeholder="Your Hugging Face token if using HF models")
106
+ openai_api_key = gr.Textbox(label="OpenAI API Key (Optional)", type="password", value=os.getenv("OPENAI_API_KEY", ""), placeholder="Your OpenAI API key")
107
+ api_endpoint = gr.Textbox(label="Default API Endpoint", value=os.getenv("API_ENDPOINT", "https://api.openai.com/v1"), placeholder="e.g., https://api.openai.com/v1")
108
+ with gr.Group():
109
+ use_custom_endpoint = gr.Checkbox(label="Use Custom API Endpoint")
110
+ custom_api_endpoint = gr.Textbox(label="Custom API URL", visible=False, placeholder="URL for your custom API endpoint")
111
+ custom_api_key = gr.Textbox(label="Custom API Key (Optional)", type="password", visible=False, placeholder="API key for the custom endpoint")
112
+
113
+ with gr.Accordion("Search Configuration", open=False):
114
+ serpapi_key = gr.Textbox(label="SerpAPI Key (Optional)", type="password", value=os.getenv("SERPAPI_API_KEY", ""), placeholder="Your SerpAPI key for web searches")
115
+ search_provider = gr.Dropdown(choices=["serper", "searxng"], value="searxng", label="Search Provider")
116
+ # search_api_key is for Serper, custom_search_url is for SearxNG.
117
+ # Default is searxng, so custom_search_url is visible, search_api_key is not.
118
+ search_api_key = gr.Textbox(label="Serper API Key", type="password", visible=False, placeholder="API key for Serper.dev if selected")
119
+ custom_search_url = gr.Textbox(label="Custom SearxNG URL", value="https://search.endorisk.nl/search", visible=True, placeholder="URL for your SearxNG instance")
120
+
121
+ submit_btn = gr.Button("Run Agent", variant="primary")
122
+
123
+ with gr.Column(scale=2):
124
  output = gr.Markdown(label="Live Agent Output")
125
  final = gr.Textbox(label="Final Answer", interactive=False)
126
  copy_btn = gr.Button("Copy Final Answer")
127
 
128
  def update_visibility(provider):
129
+ is_searxng = (provider == "searxng")
130
+ is_serper = (provider == "serper")
131
  return {
132
+ custom_search_url: gr.update(visible=is_searxng),
133
+ search_api_key: gr.update(visible=is_serper)
134
  }
135
 
136
  def update_custom_fields(checked):
 
149
  show_progress=True
150
  )
151
 
152
+ # Output actions
153
  copy_btn.click(
154
+ fn=None,
155
  inputs=final,
156
+ outputs=None,
157
+ js="(text) => { if (text) { navigator.clipboard.writeText(text); return 'Copied!'; } return ''; }"
158
  )
159
+ # Removed the non-existent export_md.click call that was here
160
 
161
  print("[DEBUG] Launching updated Gradio interface")
162
  demo.launch()
163
 
164
  if __name__ == "__main__":
165
+ launch_interface()
scripts/__pycache__/cookies.cpython-312.pyc CHANGED
Binary files a/scripts/__pycache__/cookies.cpython-312.pyc and b/scripts/__pycache__/cookies.cpython-312.pyc differ
 
scripts/__pycache__/mdconvert.cpython-312.pyc CHANGED
Binary files a/scripts/__pycache__/mdconvert.cpython-312.pyc and b/scripts/__pycache__/mdconvert.cpython-312.pyc differ
 
scripts/__pycache__/text_inspector_tool.cpython-312.pyc CHANGED
Binary files a/scripts/__pycache__/text_inspector_tool.cpython-312.pyc and b/scripts/__pycache__/text_inspector_tool.cpython-312.pyc differ
 
scripts/__pycache__/text_web_browser.cpython-312.pyc CHANGED
Binary files a/scripts/__pycache__/text_web_browser.cpython-312.pyc and b/scripts/__pycache__/text_web_browser.cpython-312.pyc differ
 
scripts/__pycache__/visual_qa.cpython-312.pyc CHANGED
Binary files a/scripts/__pycache__/visual_qa.cpython-312.pyc and b/scripts/__pycache__/visual_qa.cpython-312.pyc differ