osanseviero's picture
Update app.py
f30196a
raw
history blame
546 Bytes
import gradio as gr
import time
def generate():
text = "Hello, this is a demo without using streaming that emulates a model"
results = ""
for word in text.split():
time.sleep(0.2)
results += word
results += " "
yield {
textbox: gr.update(visible=True),
generation: results
}
with gr.Blocks() as demo:
btn = gr.Button("Generate")
out = gr.Textbox(label="Generation", visible=False)
btn.click(fn=generate, outputs=[out, out])
demo.launch(debug=True)