victorzhu30 commited on
Commit
dd30e4c
·
1 Parent(s): c0a33e8

initial commit

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def echo(message, history):
4
+ print(history)
5
+ # []
6
+ # [{'role': 'user', 'metadata': None, 'content': '1', 'options': None}, {'role': 'assistant', 'metadata': None, 'content': 'you typed: 1', 'options': None}]
7
+ # [{'role': 'user', 'metadata': None, 'content': '1', 'options': None}, {'role': 'assistant', 'metadata': None, 'content': 'you typed: 1', 'options': None}, {'role': 'user', 'metadata': None, 'content': '2', 'options': None}, {'role': 'assistant', 'metadata': None, 'content': 'you typed: 2', 'options': None}]
8
+ return f"you typed: {message}"
9
+
10
+ demo = gr.ChatInterface(
11
+ fn=echo,
12
+ type="messages",
13
+ autofocus=True,
14
+ title="Chatbot",
15
+ description="aaaa"
16
+ )
17
+
18
+ demo.launch()