Ark4u commited on
Commit
a5a9d98
·
verified ·
1 Parent(s): 3fcf7a5

Deploy OmniAssistant smolagent (Hugging Face Agents Course Unit 1)

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +9 -1
Gradio_UI.py CHANGED
@@ -272,6 +272,7 @@ class GradioUI:
272
  ),
273
  resizable=True,
274
  scale=1,
 
275
  )
276
  # If an upload folder is provided, enable the upload feature
277
  if self.file_upload_folder is not None:
@@ -289,7 +290,14 @@ class GradioUI:
289
  [stored_messages, text_input],
290
  ).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
291
 
292
- demo.launch(debug=True, share=True, **kwargs)
 
 
 
 
 
 
 
293
 
294
 
295
  __all__ = ["stream_to_gradio", "GradioUI"]
 
272
  ),
273
  resizable=True,
274
  scale=1,
275
+ type="messages",
276
  )
277
  # If an upload folder is provided, enable the upload feature
278
  if self.file_upload_folder is not None:
 
290
  [stored_messages, text_input],
291
  ).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
292
 
293
+ is_space = bool(os.getenv("SPACE_ID"))
294
+ launch_kwargs = {
295
+ "debug": True,
296
+ "share": False if is_space else True,
297
+ "ssr_mode": False,
298
+ }
299
+ launch_kwargs.update(kwargs)
300
+ demo.launch(**launch_kwargs)
301
 
302
 
303
  __all__ = ["stream_to_gradio", "GradioUI"]