File size: 957 Bytes
99eae06
ac11fa0
 
99eae06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50cdeaf
99eae06
50cdeaf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
# Example import in your app.py
from text_to_image import ov_pipe

def generate_from_text(text, seed, num_steps, _=gr.Progress(track_tqdm=True)):
    result = ov_pipe(text, num_inference_steps=num_steps, seed=seed)
    return result["sample"][0]

with gr.Blocks() as demo:
    with gr.Tab("Text-to-Image generation"):
        with gr.Row():
            with gr.Column():
                text_input = gr.Textbox(lines=3, label="Text")
                seed_input = gr.Slider(0, 10000000, value=42, label="Seed")
                steps_input = gr.Slider(1, 50, value=20, step=1, label="Steps")
            out = gr.Image(label="Result", type="pil")
        btn = gr.Button()
        btn.click(generate_from_text, [text_input, seed_input, steps_input], out)

    # Remove the "Image-to-Image generation" tab and its content

try:
    demo.launch(debug=True,inline=False)
except Exception:
    demo.launch(share=True, debug=True,inline=False)