Spaces:
Starting
Starting
File size: 409 Bytes
aea1646 509f43f aea1646 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import gradio as gr
import time
def validate_input(x):
print("VALIDATE", x)
return gr.validate(x != "error", "Can't be error")
def do_chat(message, history):
for i in range(len(message)):
time.sleep(0.05)
yield "You typed: " + message[: i + 1]
demo = gr.ChatInterface(fn=do_chat, validator=validate_input, show_progress="full")
if __name__ == "__main__":
demo.launch()
|