Spaces:
Sleeping
Sleeping
Commit
·
8dcae72
1
Parent(s):
e195ded
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
import time
|
3 |
|
4 |
-
|
5 |
def generate():
|
6 |
text = "Hello, this is a demo without using streaming that emulates a model"
|
7 |
results = ""
|
8 |
for word in text.split():
|
9 |
time.sleep(0.2)
|
10 |
-
results
|
11 |
-
results
|
12 |
yield results
|
13 |
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
generate,
|
17 |
-
inputs=None,
|
18 |
-
outputs="text"
|
19 |
-
).launch(debug=True)
|
|
|
1 |
import gradio as gr
|
2 |
import time
|
3 |
|
|
|
4 |
def generate():
|
5 |
text = "Hello, this is a demo without using streaming that emulates a model"
|
6 |
results = ""
|
7 |
for word in text.split():
|
8 |
time.sleep(0.2)
|
9 |
+
results += word
|
10 |
+
results += " "
|
11 |
yield results
|
12 |
|
13 |
+
with gr.Blocks() as demo:
|
14 |
+
btn = gr.Button("Generate")
|
15 |
+
out = gr.Textbox(label="Generation")
|
16 |
+
btn.click(fn=generate, outputs=out)
|
17 |
|
18 |
+
demo.launch(debug=True)
|
|
|
|
|
|
|
|