File size: 592 Bytes
edf578e
 
 
b815d7a
 
 
 
 
edf578e
 
685edaf
edf578e
7f6447d
8dcae72
 
b815d7a
685edaf
8dcae72
 
f30196a
b8226eb
 
edf578e
8dcae72
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
import time

def change_visibility():
    return {
        textbox: gr.update(visible=True)
    }

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 results
        
with gr.Blocks() as demo:
    btn = gr.Button("Generate")
    out = gr.Textbox(label="Generation", visible=False)
    btn.click(fn=generate, outputs=out)
    btn.click(fn=change_visibility, outputs=out)

demo.launch(debug=True)