Spaces:
Sleeping
Sleeping
victoriaono
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
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()
|