Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -105,12 +105,12 @@ def respond(
|
|
| 105 |
yield response
|
| 106 |
|
| 107 |
except Exception:
|
| 108 |
-
#
|
| 109 |
-
yield "
|
| 110 |
|
| 111 |
-
# Gradio interface
|
| 112 |
demo = gr.ChatInterface(
|
| 113 |
-
respond,
|
| 114 |
additional_inputs=[
|
| 115 |
gr.Textbox(value="You are an AI dermatologist Chatbot.", label="System message"),
|
| 116 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
|
@@ -123,11 +123,9 @@ demo = gr.ChatInterface(
|
|
| 123 |
label="Top-p (nucleus sampling)",
|
| 124 |
),
|
| 125 |
],
|
| 126 |
-
# Enable to retain history and suppress errors
|
| 127 |
-
retain_history=True, # This will ensure the chat history is not lost between interactions
|
| 128 |
-
retry_on_error=False # Prevent showing the error message or retry button
|
| 129 |
)
|
| 130 |
|
| 131 |
if __name__ == "__main__":
|
| 132 |
demo.launch()
|
| 133 |
|
|
|
|
|
|
| 105 |
yield response
|
| 106 |
|
| 107 |
except Exception:
|
| 108 |
+
# Handle any error silently (without showing the error icon or message)
|
| 109 |
+
yield "An internal error occurred. But let's continue." # Custom message or silent
|
| 110 |
|
| 111 |
+
# Gradio interface for customizable chatbot behavior
|
| 112 |
demo = gr.ChatInterface(
|
| 113 |
+
fn=respond,
|
| 114 |
additional_inputs=[
|
| 115 |
gr.Textbox(value="You are an AI dermatologist Chatbot.", label="System message"),
|
| 116 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
|
|
|
| 123 |
label="Top-p (nucleus sampling)",
|
| 124 |
),
|
| 125 |
],
|
|
|
|
|
|
|
|
|
|
| 126 |
)
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
demo.launch()
|
| 130 |
|
| 131 |
+
|