Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,8 +39,15 @@ def get_updates(history):
|
|
| 39 |
# If no new messages, return the current history
|
| 40 |
return history
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
# Create the Gradio interface
|
| 43 |
-
with gr.Blocks(css=
|
| 44 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 45 |
msg = gr.Textbox(label="Type your message here")
|
| 46 |
clear = gr.Button("Clear")
|
|
@@ -49,9 +56,9 @@ with gr.Blocks(css="#chatbot {height: 400px; overflow-y: auto;}") as demo:
|
|
| 49 |
msg.submit(chat, [msg, chatbot, user_id], [msg, chatbot, user_id])
|
| 50 |
clear.click(lambda: [], outputs=[chatbot])
|
| 51 |
|
| 52 |
-
# Add an update function that runs every
|
| 53 |
demo.load(get_updates, inputs=chatbot, outputs=chatbot, every=0.05)
|
| 54 |
|
| 55 |
# Launch the app
|
| 56 |
if __name__ == "__main__":
|
| 57 |
-
demo.launch()
|
|
|
|
| 39 |
# If no new messages, return the current history
|
| 40 |
return history
|
| 41 |
|
| 42 |
+
# Custom CSS to hide the loading animation
|
| 43 |
+
custom_css = """
|
| 44 |
+
#chatbot .loading {
|
| 45 |
+
display: none !important;
|
| 46 |
+
}
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
# Create the Gradio interface
|
| 50 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 51 |
chatbot = gr.Chatbot(elem_id="chatbot")
|
| 52 |
msg = gr.Textbox(label="Type your message here")
|
| 53 |
clear = gr.Button("Clear")
|
|
|
|
| 56 |
msg.submit(chat, [msg, chatbot, user_id], [msg, chatbot, user_id])
|
| 57 |
clear.click(lambda: [], outputs=[chatbot])
|
| 58 |
|
| 59 |
+
# Add an update function that runs every 0.05 seconds
|
| 60 |
demo.load(get_updates, inputs=chatbot, outputs=chatbot, every=0.05)
|
| 61 |
|
| 62 |
# Launch the app
|
| 63 |
if __name__ == "__main__":
|
| 64 |
+
demo.launch()
|