Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from inference import generate_images
|
3 |
+
|
4 |
+
def infer(prompt):
|
5 |
+
images = generate_images(prompt, model_path="output/", num_images=1)
|
6 |
+
return images[0]
|
7 |
+
|
8 |
+
with gr.Blocks() as demo:
|
9 |
+
with gr.Row():
|
10 |
+
gr.Markdown("## Image Generation Demo")
|
11 |
+
with gr.Row():
|
12 |
+
with gr.Column():
|
13 |
+
prompt = gr.Textbox(label="Prompt", lines=2)
|
14 |
+
submit = gr.Button("Generate Image")
|
15 |
+
with gr.Column():
|
16 |
+
output_image = gr.Image(label="Generated Image")
|
17 |
+
|
18 |
+
submit.click(infer, inputs=prompt, outputs=output_image)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
demo.launch()
|