Spaces:
Sleeping
Sleeping
aaaaa
Browse files
app.py
CHANGED
|
@@ -56,6 +56,7 @@ def respond(
|
|
| 56 |
def cancel_inference():
|
| 57 |
global stop_inference
|
| 58 |
stop_inference = True
|
|
|
|
| 59 |
|
| 60 |
# Custom CSS for a fancy look
|
| 61 |
custom_css = """
|
|
@@ -118,12 +119,15 @@ demo = gr.ChatInterface(
|
|
| 118 |
label="Top-p (nucleus sampling)",
|
| 119 |
),
|
| 120 |
gr.Checkbox(label="Use Local Model", value=False),
|
| 121 |
-
gr.Button("Cancel Inference"
|
| 122 |
],
|
| 123 |
css=custom_css,
|
| 124 |
title="π Fancy AI Chatbot π",
|
| 125 |
description="Interact with the AI chatbot using customizable settings below."
|
| 126 |
)
|
| 127 |
|
|
|
|
|
|
|
|
|
|
| 128 |
if __name__ == "__main__":
|
| 129 |
demo.launch()
|
|
|
|
| 56 |
def cancel_inference():
|
| 57 |
global stop_inference
|
| 58 |
stop_inference = True
|
| 59 |
+
return gr.update(label="Inference cancelled.")
|
| 60 |
|
| 61 |
# Custom CSS for a fancy look
|
| 62 |
custom_css = """
|
|
|
|
| 119 |
label="Top-p (nucleus sampling)",
|
| 120 |
),
|
| 121 |
gr.Checkbox(label="Use Local Model", value=False),
|
| 122 |
+
gr.Button("Cancel Inference"),
|
| 123 |
],
|
| 124 |
css=custom_css,
|
| 125 |
title="π Fancy AI Chatbot π",
|
| 126 |
description="Interact with the AI chatbot using customizable settings below."
|
| 127 |
)
|
| 128 |
|
| 129 |
+
cancel_button = demo.add_button("Cancel Inference", variant="danger", elem_id="cancel_button")
|
| 130 |
+
cancel_button.click(cancel_inference, None, None)
|
| 131 |
+
|
| 132 |
if __name__ == "__main__":
|
| 133 |
demo.launch()
|