dawood HF Staff commited on
Commit
2e4e252
·
verified ·
1 Parent(s): 2482401

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -27
app.py CHANGED
@@ -1,27 +1,26 @@
1
- import random
2
-
3
- import gradio as gr
4
-
5
-
6
- def chat(message, history):
7
- history = history or []
8
- if message.startswith("How many"):
9
- response = random.randint(1, 10)
10
- elif message.startswith("How"):
11
- response = random.choice(["Great", "Good", "Okay", "Bad"])
12
- elif message.startswith("Where"):
13
- response = random.choice(["Here", "There", "Somewhere"])
14
- else:
15
- response = "I don't know"
16
- history.append((message, response))
17
- return history, history
18
-
19
-
20
- iface = gr.Interface(
21
- chat,
22
- ["text", "state"],
23
- ["chatbot", "state"],
24
- allow_screenshot=False,
25
- allow_flagging="never",
26
- )
27
- iface.launch()
 
1
+ import random
2
+
3
+ import gradio as gr
4
+
5
+
6
+ def chat(message, history):
7
+ history = history or []
8
+ if message.startswith("How many"):
9
+ response = random.randint(1, 10)
10
+ elif message.startswith("How"):
11
+ response = random.choice(["Great", "Good", "Okay", "Bad"])
12
+ elif message.startswith("Where"):
13
+ response = random.choice(["Here", "There", "Somewhere"])
14
+ else:
15
+ response = "I don't know"
16
+ history.append((message, response))
17
+ return history, history
18
+
19
+
20
+ iface = gr.Interface(
21
+ chat,
22
+ ["text", "state"],
23
+ ["chatbot", "state"],
24
+ allow_flagging="never",
25
+ )
26
+ iface.launch()