tagny commited on
Commit
6befe7b
·
verified ·
1 Parent(s): 51264a9

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +1 -30
Gradio_UI.py CHANGED
@@ -180,39 +180,10 @@ def stream_to_gradio(
180
  yield gr.ChatMessage(role="assistant", content=f"**Final answer:** {str(final_answer)}")
181
 
182
 
183
- class AgentCloner:
184
- def __init__(self, avalaible_tools: list[callable], prompt_templates: list[dict]) -> None:
185
- self.avalaible_tools = avalaible_tools
186
- self.prompt_templates = prompt_templates
187
-
188
- def clone(self):
189
- new_model_client = HfApiModel(
190
- max_tokens=2096,
191
- temperature=0.5,
192
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
193
- custom_role_conversions=None,
194
- )
195
- final_answer = FinalAnswerTool()
196
- new_agent = CodeAgent(
197
- model=new_model_client,
198
- # tools=self.avalaible_tools,
199
- tools=[final_answer],
200
- max_steps=6,
201
- verbosity_level=1,
202
- grammar=None,
203
- planning_interval=None,
204
- name=None,
205
- description=None,
206
- prompt_templates=self.prompt_templates
207
- )
208
- return new_agent
209
-
210
-
211
-
212
  class GradioUI:
213
  """A one-line interface to launch your agent in Gradio"""
214
 
215
- def __init__(self, agent_cloner: AgentCloner, file_upload_folder: str | None = None):
216
  if not _is_package_available("gradio"):
217
  raise ModuleNotFoundError(
218
  "Please install 'gradio' extra to use the GradioUI: `pip install 'smolagents[gradio]'`"
 
180
  yield gr.ChatMessage(role="assistant", content=f"**Final answer:** {str(final_answer)}")
181
 
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  class GradioUI:
184
  """A one-line interface to launch your agent in Gradio"""
185
 
186
+ def __init__(self, agent_cloner, file_upload_folder: str | None = None):
187
  if not _is_package_available("gradio"):
188
  raise ModuleNotFoundError(
189
  "Please install 'gradio' extra to use the GradioUI: `pip install 'smolagents[gradio]'`"