Chatbot-demo / app.py
sanaweb's picture
Update app.py
3b1cc6e verified
Raw
History Blame Contribute Delete
846 Bytes
import time
import gradio as gr
def slow_echo(message, history):
for i in range(len(message)):
time.sleep(0.05)
yield "متن شما: " + message[: i+1]
demo = gr.ChatInterface(slow_echo).queue()
if __name__ == "__main__":
demo.launch()
###import gradio as gr
def yes_man(message, history):
if message.endswith("?"):
return "Yes"
else:
return "Ask me anything!"
gr.ChatInterface(
yes_man,
chatbot=gr.Chatbot(height=300),
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
title="Yes Man",
description="Ask Yes Man any question",
theme="soft",
examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
cache_examples=True,
retry_btn=None,
undo_btn="Delete Previous",
clear_btn="پاک کردن",
).launch()