montyanderson commited on
Commit
3bebd7a
1 Parent(s): ff4fa03

`app.py`: upgrade layout

Browse files
Files changed (1) hide show
  1. app.py +42 -28
app.py CHANGED
@@ -81,14 +81,16 @@ def image_to_base64(image_path):
81
 
82
  prodia_client = Prodia(api_key=os.getenv("PRODIA_API_KEY"))
83
 
84
- def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale):
85
  result = prodia_client.generate({
86
  "prompt": prompt,
87
  "negative_prompt": negative_prompt,
88
  "model": model,
89
  "steps": steps,
90
  "sampler": sampler,
91
- "cfg_scale": cfg_scale
 
 
92
  })
93
 
94
  job = prodia_client.wait(result)
@@ -113,40 +115,52 @@ with gr.Blocks(css=css) as demo:
113
  with gr.Row():
114
  with gr.Column(scale=3):
115
  with gr.Tab("Generation"):
 
 
116
  with gr.Row():
117
  with gr.Column(scale=1):
118
- model = gr.Dropdown(interactive=True,value="v1-5-pruned-emaonly.safetensors [d7049739]", show_label=False, choices=prodia_client.list_models())
119
-
120
- sampler = gr.Dropdown(value="Euler a", show_label=False, choices=[
121
- "Euler",
122
- "Euler a",
123
- "LMS",
124
- "Heun",
125
- "DPM2",
126
- "DPM2 a",
127
- "DPM++ 2S a",
128
- "DPM++ 2M",
129
- "DPM++ SDE",
130
- "DPM fast",
131
- "DPM adaptive",
132
- "LMS Karras",
133
- "DPM2 Karras",
134
- "DPM2 a Karras",
135
- "DPM++ 2S a Karras",
136
- "DPM++ 2M Karras",
137
- "DPM++ SDE Karras",
138
- "DDIM",
139
- "PLMS",
140
  ])
141
-
142
  with gr.Column(scale=1):
143
- steps = gr.Slider(label="Steps", miniumum=1, maximum=50, value=25)
144
- cfg_scale = gr.Slider(label="CFG Scale", miniumum=1, maximum=20, value=7)
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  with gr.Column(scale=2):
147
  image_output = gr.Image()
148
 
149
- text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale], outputs=image_output)
150
 
151
 
152
  demo.launch()
 
81
 
82
  prodia_client = Prodia(api_key=os.getenv("PRODIA_API_KEY"))
83
 
84
+ def flip_text(prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height):
85
  result = prodia_client.generate({
86
  "prompt": prompt,
87
  "negative_prompt": negative_prompt,
88
  "model": model,
89
  "steps": steps,
90
  "sampler": sampler,
91
+ "cfg_scale": cfg_scale,
92
+ "width": width,
93
+ "height": height
94
  })
95
 
96
  job = prodia_client.wait(result)
 
115
  with gr.Row():
116
  with gr.Column(scale=3):
117
  with gr.Tab("Generation"):
118
+ model = gr.Dropdown(interactive=True,value="v1-5-pruned-emaonly.safetensors [d7049739]", show_label=True, label="Model", choices=prodia_client.list_models())
119
+
120
  with gr.Row():
121
  with gr.Column(scale=1):
122
+ sampler = gr.Dropdown(value="Euler a", show_label=True, label="Sampling Method", choices=[
123
+ "Euler",
124
+ "Euler a",
125
+ "LMS",
126
+ "Heun",
127
+ "DPM2",
128
+ "DPM2 a",
129
+ "DPM++ 2S a",
130
+ "DPM++ 2M",
131
+ "DPM++ SDE",
132
+ "DPM fast",
133
+ "DPM adaptive",
134
+ "LMS Karras",
135
+ "DPM2 Karras",
136
+ "DPM2 a Karras",
137
+ "DPM++ 2S a Karras",
138
+ "DPM++ 2M Karras",
139
+ "DPM++ SDE Karras",
140
+ "DDIM",
141
+ "PLMS",
 
 
142
  ])
143
+
144
  with gr.Column(scale=1):
145
+ steps = gr.Slider(label="Sampling Steps", miniumum=1, maximum=50, value=25, step=1)
146
+
147
+ with gr.Row():
148
+ with gr.Column(scale=1):
149
+ width = gr.Slider(label="Width", miniumum=1, maximum=1024, value=512, step=1)
150
+ height = gr.Slider(label="Height", miniumum=1, maximum=1024, value=512, step=1)
151
+
152
+ with gr.Column(scale=1):
153
+ batch_size = gr.Slider(label="Batch Size", miniumum=1, maximum=1, value=1)
154
+ batch_count = gr.Slider(label="Batch Count", miniumum=1, maximum=1, value=1)
155
+
156
+ cfg_scale = gr.Slider(label="CFG Scale", miniumum=1, maximum=20, value=7, step=1)
157
+ seed = gr.Number(label="Seed", value=-1)
158
+
159
 
160
  with gr.Column(scale=2):
161
  image_output = gr.Image()
162
 
163
+ text_button.click(flip_text, inputs=[prompt, negative_prompt, model, steps, sampler, cfg_scale, width, height], outputs=image_output)
164
 
165
 
166
  demo.launch()