Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|