anisotropies commited on
Commit
1a40265
·
verified ·
1 Parent(s): 8b0f7f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -1,18 +1,21 @@
1
- # import gradio as gr
2
-
3
- # demo = gr.load("mistralai/Mistral-7B-Instruct-v0.2",
4
- # title="Someone's Chatty",
5
- # description="What would you like to chat about?",
6
- # src="models")
7
-
8
- # demo.launch()
9
-
10
- import time
11
  import gradio as gr
12
 
13
- def slow_echo(message, history):
14
- for i in range(len(message)):
15
- time.sleep(0.3)
16
- yield "You typed: " + message[: i+1]
 
17
 
18
- gr.ChatInterface(slow_echo).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def yes_man(message, history):
4
+ if message.endswith("?"):
5
+ return "Yes"
6
+ else:
7
+ return "Ask me anything!"
8
 
9
+ gr.ChatInterface(
10
+ yes_man,
11
+ chatbot=gr.Chatbot(height=300),
12
+ textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
13
+ title="Yes Man",
14
+ description="Ask Yes Man any question",
15
+ theme="soft",
16
+ examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
17
+ cache_examples=True,
18
+ retry_btn=None,
19
+ undo_btn="Delete Previous",
20
+ clear_btn="Clear",
21
+ ).launch()