victoriaono commited on
Commit
1e79d7a
·
verified ·
1 Parent(s): 6ef1973

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -1,13 +1,18 @@
1
  import gradio as gr
2
 
3
- def fake(message, history):
4
- if message.strip():
5
- return gr.Audio("https://github.com/gradio-app/gradio/raw/main/test/test_files/audio_sample.wav")
6
- else:
7
- return "Please provide the name of an artist"
8
-
9
- gr.ChatInterface(
10
- fake,
11
- textbox=gr.Textbox(placeholder="Which artist's music do you want to listen to?", scale=7),
12
- chatbot=gr.Chatbot(placeholder="Play music by any artist!"),
13
- ).launch()
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ def echo(message, history, system_prompt, tokens):
4
+ response = f"System prompt: {system_prompt}\n Message: {message}."
5
+ for i in range(min(len(response), int(tokens))):
6
+ time.sleep(0.05)
7
+ yield response[: i + 1]
8
+
9
+
10
+ demo = gr.ChatInterface(
11
+ echo,
12
+ additional_inputs=[
13
+ gr.Textbox("You are helpful AI.", label="System Prompt"),
14
+ gr.Slider(10, 100),
15
+ ],
16
+ )
17
+
18
+ demo.launch()