fffiloni commited on
Commit
b6fbab7
1 Parent(s): 360f0c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -17
app.py CHANGED
@@ -131,20 +131,54 @@ description = "Gradio Demo for PASD Real-ISR. To use it, simply upload your imag
131
  article = "<p style='text-align: center'><a href='https://github.com/yangxy/PASD' target='_blank'>Github Repo Pytorch</a></p>"
132
  #examples=[['samples/27d38eeb2dbbe7c9.png'],['samples/629e4da70703193b.png']]
133
 
134
- demo = gr.Interface(
135
- fn=inference,
136
- inputs=[gr.Image(type="pil", sources=["upload"]),
137
- gr.Textbox(label="Prompt", value="Asian"),
138
- gr.Textbox(label="Added Prompt", value='clean, high-resolution, 8k, best quality, masterpiece'),
139
- gr.Textbox(label="Negative Prompt",value='dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'),
140
- gr.Slider(label="Denoise Steps", minimum=10, maximum=50, value=20, step=1),
141
- gr.Slider(label="Upsample Scale", minimum=1, maximum=4, value=2, step=1),
142
- gr.Slider(label="Conditioning Scale", minimum=0.5, maximum=1.5, value=1.1, step=0.1),
143
- gr.Slider(label="Classier-free Guidance", minimum=0.1, maximum=10.0, value=7.5, step=0.1),
144
- gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, randomize=True)],
145
- outputs=[ImageSlider(position=0.5), gr.File()],
146
- title=title,
147
- description=description,
148
- article=article).queue()
149
-
150
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  article = "<p style='text-align: center'><a href='https://github.com/yangxy/PASD' target='_blank'>Github Repo Pytorch</a></p>"
132
  #examples=[['samples/27d38eeb2dbbe7c9.png'],['samples/629e4da70703193b.png']]
133
 
134
+ css = """
135
+ #col-container{
136
+ margin: 0 auto;
137
+ max-width: 720px;
138
+ }
139
+ """
140
+
141
+ with gr.Blocks(css=css) as demo:
142
+ with gr.Column(elem_id="col-container"):
143
+ with gr.HTML(f"""
144
+ <h2 style="text-align: center;>
145
+ {title}
146
+ </h2>
147
+ <p style="text-align: center;>
148
+ {description} <br />
149
+ {article}
150
+ </p>
151
+
152
+ """)
153
+ with gr.Row():
154
+ with gr.Column():
155
+ input_image = gr.Image(type="pil", sources=["upload"])
156
+ prompt_in = gr.Textbox(label="Prompt", value="Asian")
157
+ with gr.Accordion(label="Advanced settings", open=False):
158
+ added_prompt = gr.Textbox(label="Added Prompt", value='clean, high-resolution, 8k, best quality, masterpiece'),
159
+ neg_promp = gr.Textbox(label="Negative Prompt",value='dotted, noise, blur, lowres, oversmooth, longbody, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'),
160
+ denoise_steps = gr.Slider(label="Denoise Steps", minimum=10, maximum=50, value=20, step=1),
161
+ upsample_scale = gr.Slider(label="Upsample Scale", minimum=1, maximum=4, value=2, step=1),
162
+ condition_scale = gr.Slider(label="Conditioning Scale", minimum=0.5, maximum=1.5, value=1.1, step=0.1),
163
+ classifier_free_guidance = gr.Slider(label="Classier-free Guidance", minimum=0.1, maximum=10.0, value=7.5, step=0.1),
164
+ seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, randomize=True)]
165
+ submit_btn = gr.Button("Submit")
166
+ with gr.Column():
167
+ b_a_slider = ImageSlider(label="B/A result", position=0.5)
168
+ file_output = gr.File(label="Downloadable image result")
169
+
170
+ submit_btn.click(
171
+ fn = inference,
172
+ inputs = [
173
+ input_image, prompt_in,
174
+ added_prompt, neg_prompt,
175
+ denoise_steps,
176
+ upsample_scale, condition_scale,
177
+ clasifier_free_guidance, seed
178
+ ],
179
+ outputs = [
180
+ b_a_slider,
181
+ file_output
182
+ ]
183
+ )
184
+ demo.queue().launch()