fffiloni commited on
Commit
08fbc70
·
verified ·
1 Parent(s): a575d82

add examples

Browse files
Files changed (1) hide show
  1. app.py +41 -16
app.py CHANGED
@@ -45,21 +45,46 @@ def generate_image(prompt, model, num_iterations, learning_rate, progress = gr.P
45
  return None, f"An error occurred: {str(e)}"
46
 
47
  # Create Gradio interface
48
- iface = gr.Interface(
49
- fn=generate_image,
50
- inputs=[
51
- gr.Textbox(label="Prompt"),
52
- gr.Dropdown(["sd-turbo", "sdxl-turbo", "pixart", "hyper-sd"], label="Model"),
53
- gr.Slider(minimum=10, maximum=100, step=10, value=50, label="Number of Iterations"),
54
- gr.Slider(minimum=0.1, maximum=10.0, step=0.1, value=5.0, label="Learning Rate"),
55
- ],
56
- outputs=[
57
- gr.Image(type="filepath", label="Generated Image"),
58
- gr.Textbox(label="Status")
59
- ],
60
- title="ReNO Image Generation",
61
- description="Enter a prompt to generate an image using ReNO. Adjust the model and parameters as needed."
62
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  # Launch the app
65
- iface.launch()
 
45
  return None, f"An error occurred: {str(e)}"
46
 
47
  # Create Gradio interface
48
+ title="# ReNO Image Generation",
49
+ description="Enter a prompt to generate an image using ReNO. Adjust the model and parameters as needed."
50
+
51
+ with gr.Blocks() as demo:
52
+ with gr.Column():
53
+ gr.Markdown(title)
54
+ gr.Markdown(description)
55
+
56
+ with gr.Row():
57
+ with gr.Column():
58
+ prompt = gr.Textbox(label="Prompt")
59
+ chosen_model = gr.Dropdown(["sd-turbo", "sdxl-turbo", "pixart", "hyper-sd"], label="Model")
60
+
61
+ with gr.Row():
62
+ n_iter = gr.Slider(minimum=10, maximum=100, step=10, value=50, label="Number of Iterations")
63
+ learning_rate = gr.Slider(minimum=0.1, maximum=10.0, step=0.1, value=5.0, label="Learning Rate")
64
+
65
+ submit_btn = gr.Button("Submit")
66
+
67
+ gr.Examples(
68
+ examples = [
69
+ "A minimalist logo design of a reindeer, fully rendered. The reindeer features distinct, complete shapes using bold and flat colors. The design emphasizes simplicity and clarity, suitable for logo use with a sharp outline and white background.",
70
+ "A blue scooter is parked near a curb in front of a green vintage car",
71
+ "A impressionistic oil painting: a lone figure walking on a misty beach, a weathered lighthouse on a cliff, seagulls above crashing waves",
72
+ "A bird with 8 legs",
73
+ "An orange chair to the right of a black airplane",
74
+ "A pink elephant and a grey cow",
75
+ ],
76
+ inputs = [prompt]
77
+ )
78
+
79
+ with gr.Column():
80
+ output_image = gr.Image(type="filepath", label="Generated Image")
81
+ status = gr.Textbox(label="Status")
82
+
83
+ submit_btn.click(
84
+ fn = generate_image,
85
+ inputs = [prompt, chosen_model, n_iter, learning_rate],
86
+ outputs = [output_image, status]
87
+ )
88
 
89
  # Launch the app
90
+ demo.queue().launch(show_error=True)