import gradio as gr | |
examples = [] | |
def yes_man(message, history): | |
if message.endswith("?"): | |
examples.append(message) | |
return "Yes" | |
else: | |
return "Ask me anything!" | |
gr.ChatInterface( | |
yes_man, | |
chatbot=gr.Chatbot(height=500), | |
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=examples, | |
cache_examples=True, | |
retry_btn=None, | |
undo_btn="Delete Previous", | |
clear_btn="Clear", | |
).launch() | |