Bhaskar2611 commited on
Commit
cc45698
·
verified ·
1 Parent(s): edb8de4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -105,12 +105,12 @@ def respond(
105
  yield response
106
 
107
  except Exception:
108
- # Suppress any error and maintain conversation without showing error icon or message
109
- yield "Error handled silently." # You can replace this with "" to hide any message
110
 
111
- # Gradio interface with preserved history and customizable chatbot behavior
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
+