File size: 742 Bytes
24a3da7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
740b9f3
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
27
28
29
30
31
32
33
""" Module for web application """

import gradio
from inference import generate_image


with gradio.Blocks() as block:
    gradio.Markdown("<h1><center>Image Generator</center></h1>")

    text = gradio.Textbox(
        label = "Text prompt",
        max_lines = 1,
    )

    btn = gradio.Button("Run")

    gallery = gradio.Gallery(
        label = "Result image",
    ).style(
        # Number of images per category
        columns = [3],
        height = "auto",
    )

    btn.click(fn=generate_image, inputs=text, outputs=gallery)

    gradio.Markdown("<p style='text-align: center'>2019130032 - Fedora Yoshe Juandy</p>")


# Use 'queue' if the inference's time > 60s
# Use 'share' for more than one user usage
block.queue().launch()