fffiloni commited on
Commit
2f22a68
·
verified ·
1 Parent(s): b421c31

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from main import main
3
+ from arguments import parse_args
4
+
5
+ def generate_image(prompt):
6
+ # Set up arguments
7
+ args = parse_args()
8
+ args.task = "single"
9
+ args.prompt = prompt
10
+ args.model = "sd-turbo" # or another supported model
11
+ args.save_dir = "./outputs"
12
+ args.save_all_images = True
13
+
14
+ # Run the main function
15
+ main(args)
16
+
17
+ # Return the path to the generated image
18
+ return f"{args.save_dir}/{args.task}/{args.model}_{args.prompt}/best_image.png"
19
+
20
+ # Create Gradio interface
21
+ iface = gr.Interface(
22
+ fn=generate_image,
23
+ inputs="text",
24
+ outputs="image",
25
+ title="ReNO Image Generation",
26
+ description="Enter a prompt to generate an image using ReNO."
27
+ )
28
+
29
+ # Launch the app
30
+ iface.launch()