Spaces:
Running
Running
crcdng
commited on
Commit
·
3d399c9
1
Parent(s):
aab4dfa
fix other elements
Browse files- Gradio_UI.py +30 -31
Gradio_UI.py
CHANGED
@@ -273,38 +273,37 @@ class GradioUI:
|
|
273 |
|
274 |
with gr.Row():
|
275 |
gr.HTML(title)
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
upload_file
|
294 |
-
|
295 |
-
|
296 |
-
[upload_status, file_uploads_log],
|
297 |
-
)
|
298 |
-
text_input = gr.Textbox(lines=1, label="Chat Message")
|
299 |
-
text_input.submit(
|
300 |
-
self.log_user_message,
|
301 |
-
[text_input, file_uploads_log],
|
302 |
-
[stored_messages, text_input],
|
303 |
-
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
304 |
-
examples = gr.Examples(
|
305 |
-
examples=[["Tell me a joke based on the current local time"],["Given the current local time, what is a fun activity to do?"],["When asked for the current local time, add 6 hours to it. What is the current local time?"]],
|
306 |
-
inputs=[text_input],
|
307 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
demo.launch(debug=True, share=True, allowed_paths=["Cyberpunk.otf"], **kwargs)
|
309 |
|
310 |
|
|
|
273 |
|
274 |
with gr.Row():
|
275 |
gr.HTML(title)
|
276 |
+
stored_messages = gr.State([])
|
277 |
+
file_uploads_log = gr.State([])
|
278 |
+
chatbot = gr.Chatbot(
|
279 |
+
label="Agent",
|
280 |
+
type="messages",
|
281 |
+
avatar_images=(
|
282 |
+
None,
|
283 |
+
"https://huggingface.co/spaces/crcdng/First_agent_template/resolve/main/agent.jpg",
|
284 |
+
),
|
285 |
+
resizeable=True,
|
286 |
+
scale=0.05,
|
287 |
+
)
|
288 |
+
# If an upload folder is provided, enable the upload feature
|
289 |
+
if self.file_upload_folder is not None:
|
290 |
+
upload_file = gr.File(label="Upload a file")
|
291 |
+
upload_status = gr.Textbox(label="Upload Status", interactive=False, visible=False)
|
292 |
+
upload_file.change(
|
293 |
+
self.upload_file,
|
294 |
+
[upload_file, file_uploads_log],
|
295 |
+
[upload_status, file_uploads_log],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
)
|
297 |
+
text_input = gr.Textbox(lines=1, label="Chat Message")
|
298 |
+
text_input.submit(
|
299 |
+
self.log_user_message,
|
300 |
+
[text_input, file_uploads_log],
|
301 |
+
[stored_messages, text_input],
|
302 |
+
).then(self.interact_with_agent, [stored_messages, chatbot], [chatbot])
|
303 |
+
examples = gr.Examples(
|
304 |
+
examples=[["Tell me a joke based on the current local time"],["Given the current local time, what is a fun activity to do?"],["When asked for the current local time, add 6 hours to it. What is the current local time?"]],
|
305 |
+
inputs=[text_input],
|
306 |
+
)
|
307 |
demo.launch(debug=True, share=True, allowed_paths=["Cyberpunk.otf"], **kwargs)
|
308 |
|
309 |
|