Tim Seufert commited on
Commit
77f8e61
·
1 Parent(s): 01a7203

chatwindow_design_update

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -50,8 +50,8 @@ def respond(message, image, chat_history):
50
  return "", chat_history.append((message, f"Error: {str(e)}"))
51
 
52
  # Create Gradio interface
53
- with gr.Blocks() as demo:
54
- chatbot = gr.ChatInterface()
55
  msg = gr.Textbox()
56
  img = gr.Image(type="filepath")
57
  clear = gr.ClearButton([msg, img, chatbot])
@@ -67,6 +67,25 @@ with gr.Blocks() as demo:
67
  )
68
 
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
 
72
 
 
50
  return "", chat_history.append((message, f"Error: {str(e)}"))
51
 
52
  # Create Gradio interface
53
+ #with gr.Blocks() as demo:
54
+ chatbot = gr.Chatbot()
55
  msg = gr.Textbox()
56
  img = gr.Image(type="filepath")
57
  clear = gr.ClearButton([msg, img, chatbot])
 
67
  )
68
 
69
 
70
+ import time
71
+ import gradio as gr
72
+
73
+ def slow_echo(message, history):
74
+ for i in range(len(message)):
75
+ time.sleep(0.05)
76
+ yield "You typed: " + message[: i + 1]
77
+
78
+ demo = gr.ChatInterface(
79
+ slow_echo,
80
+ type="messages",
81
+ flagging_mode="manual",
82
+ flagging_options=["Like", "Spam", "Inappropriate", "Other"],
83
+ save_history=True,
84
+ )
85
+
86
+ if __name__ == "__main__":
87
+ demo.launch()
88
+
89
 
90
 
91