Tijmen2 commited on
Commit
6a2645a
1 Parent(s): fe25716

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -64,14 +64,13 @@ def respond_stream(message, history):
64
  yield f"Error during generation: {e}"
65
 
66
 
67
-
68
- # Use gr.Chatbot for streaming and history management
69
- chatbot = gr.Chatbot() # No need to specify fn here
70
- chatbot.set_welcome_message(get_random_greeting())
71
 
72
  with gr.Blocks() as demo:
73
  chatbot.render()
74
  clear = gr.Button("Clear")
75
- clear.click(lambda: None, None, chatbot, fn=lambda: []) # Correct clearing
76
- chatbot.queue().launch()
77
-
 
64
  yield f"Error during generation: {e}"
65
 
66
 
67
+ # Display the welcome message as the first assistant message
68
+ initial_message = random.choice(GREETING_MESSAGES)
69
+ chatbot = gr.Chatbot(value=[[None, initial_message]]) # Set initial value here
 
70
 
71
  with gr.Blocks() as demo:
72
  chatbot.render()
73
  clear = gr.Button("Clear")
74
+ clear.click(lambda: None, None, chatbot, fn=lambda: [])
75
+
76
+ demo.queue().launch()