Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,18 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import time
|
3 |
|
4 |
+
def echo(message, history, system_prompt, tokens):
|
5 |
+
response = f"System prompt: {system_prompt}\n Message: {message}."
|
6 |
+
for i in range(min(len(response), int(tokens))):
|
7 |
+
time.sleep(0.05)
|
8 |
+
yield response[: i+1]
|
9 |
|
10 |
+
demo = gr.ChatInterface(echo,
|
11 |
+
additional_inputs=[
|
12 |
+
gr.Textbox("You are helpful AI.", label="System Prompt"),
|
13 |
+
gr.Slider(10, 100)
|
14 |
+
]
|
15 |
+
)
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
demo.queue().launch()
|