Spaces:
Paused
Paused
Update Gradio_UI.py
Browse files- Gradio_UI.py +1 -15
Gradio_UI.py
CHANGED
|
@@ -191,20 +191,6 @@ class GradioUI:
|
|
| 191 |
if self.file_upload_folder is not None:
|
| 192 |
if not os.path.exists(file_upload_folder):
|
| 193 |
os.mkdir(file_upload_folder)
|
| 194 |
-
# see https://www.gradio.app/guides/state-in-blocks#session-state
|
| 195 |
-
# for non deep copyable object / to distinguish data per conversation
|
| 196 |
-
all_users_stored_messages = {}
|
| 197 |
-
all_users_file_uploads_log = {}
|
| 198 |
-
|
| 199 |
-
def initialize_session_data(self, request: gr.Request):
|
| 200 |
-
all_users_stored_messages[request.session_hash] = gr.State([])
|
| 201 |
-
all_users_file_uploads_log[request.session_hash] = gr.State([])
|
| 202 |
-
return "Session initialized!"
|
| 203 |
-
|
| 204 |
-
def cleanup_session_data(self, request: gr.Request):
|
| 205 |
-
if request.session_hash in instances:
|
| 206 |
-
del all_users_stored_messages[request.session_hash]
|
| 207 |
-
del all_users_file_uploads_log[request.session_hash]
|
| 208 |
|
| 209 |
def interact_with_agent(self, prompt, messages):
|
| 210 |
import gradio as gr
|
|
@@ -280,7 +266,7 @@ class GradioUI:
|
|
| 280 |
|
| 281 |
with gr.Blocks(fill_height=True) as demo:
|
| 282 |
# user_state = gr.State(random.random) # to avoid sharing gr.State across users (that uses all the users conversations for any user prompts)
|
| 283 |
-
gr.Label("
|
| 284 |
stored_messages = gr.State([])
|
| 285 |
file_uploads_log = gr.State([])
|
| 286 |
chatbot = gr.Chatbot(
|
|
|
|
| 191 |
if self.file_upload_folder is not None:
|
| 192 |
if not os.path.exists(file_upload_folder):
|
| 193 |
os.mkdir(file_upload_folder)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
def interact_with_agent(self, prompt, messages):
|
| 196 |
import gradio as gr
|
|
|
|
| 266 |
|
| 267 |
with gr.Blocks(fill_height=True) as demo:
|
| 268 |
# user_state = gr.State(random.random) # to avoid sharing gr.State across users (that uses all the users conversations for any user prompts)
|
| 269 |
+
gr.Label("Welcome to my first smolagent! You can use tools to get the time in a location, visit a URL page, search with DuckDuckGo.")
|
| 270 |
stored_messages = gr.State([])
|
| 271 |
file_uploads_log = gr.State([])
|
| 272 |
chatbot = gr.Chatbot(
|