hysts HF Staff commited on
Commit
79fbe1c
·
verified ·
1 Parent(s): 148d77d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ # MultimodalTextbox in ChatInterface - validation error is invisible
5
+ def validate_input(x):
6
+ return gr.validate(x["text"] != "error", "Can't be error")
7
+
8
+
9
+ def do_chat(message, history):
10
+ yield "You typed: " + message["text"]
11
+
12
+
13
+ demo = gr.ChatInterface(
14
+ fn=do_chat,
15
+ validator=validate_input,
16
+ multimodal=True,
17
+ show_progress="full",
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ demo.launch()