Spaces:
Sleeping
Sleeping
Update func.py
Browse files
func.py
CHANGED
|
@@ -248,78 +248,7 @@ def main():
|
|
| 248 |
|
| 249 |
|
| 250 |
# ========== GRADIO INTERFACE ==========
|
| 251 |
-
|
| 252 |
-
gr.Markdown("""
|
| 253 |
-
# ๐ฎ NAFNet Image Deblurring
|
| 254 |
-
**Upload a blurry image and compare with deblurred result**
|
| 255 |
-
""")
|
| 256 |
-
|
| 257 |
-
with gr.Row():
|
| 258 |
-
with gr.Column(scale=1):
|
| 259 |
-
# Upload
|
| 260 |
-
upload = gr.Image(
|
| 261 |
-
label="๐ค Upload Image",
|
| 262 |
-
type="pil",
|
| 263 |
-
height=250
|
| 264 |
-
)
|
| 265 |
-
|
| 266 |
-
# Process button
|
| 267 |
-
process_btn = gr.Button(
|
| 268 |
-
"๐ Process Image",
|
| 269 |
-
variant="primary",
|
| 270 |
-
size="lg"
|
| 271 |
-
)
|
| 272 |
-
|
| 273 |
-
# Status
|
| 274 |
-
status = gr.Textbox(
|
| 275 |
-
label="Status",
|
| 276 |
-
value="Ready to process",
|
| 277 |
-
interactive=False
|
| 278 |
-
)
|
| 279 |
-
|
| 280 |
-
gr.Markdown("""
|
| 281 |
-
### Instructions:
|
| 282 |
-
1. Upload blurry image
|
| 283 |
-
2. Click **Process Image**
|
| 284 |
-
3. Wait a few seconds
|
| 285 |
-
4. Drag the red line to compare
|
| 286 |
-
""")
|
| 287 |
-
|
| 288 |
-
with gr.Column(scale=2):
|
| 289 |
-
# Interactive comparison
|
| 290 |
-
html_output = gr.HTML(
|
| 291 |
-
label="๐ Interactive Comparison",
|
| 292 |
-
value="<div style='text-align: center; padding: 50px; color: #666;'>Upload an image to begin</div>"
|
| 293 |
-
)
|
| 294 |
-
|
| 295 |
-
# Side-by-side
|
| 296 |
-
with gr.Accordion("๐ธ Side-by-Side View", open=True):
|
| 297 |
-
side_by_side = gr.Image(
|
| 298 |
-
label="Original vs Deblurred",
|
| 299 |
-
type="pil",
|
| 300 |
-
height=350
|
| 301 |
-
)
|
| 302 |
-
|
| 303 |
-
# Event handlers
|
| 304 |
-
process_btn.click(
|
| 305 |
-
fn=process_image,
|
| 306 |
-
inputs=[upload],
|
| 307 |
-
outputs=[html_output, side_by_side, status]
|
| 308 |
-
)
|
| 309 |
-
|
| 310 |
-
# Clear when new image uploaded
|
| 311 |
-
upload.change(
|
| 312 |
-
fn=lambda: (
|
| 313 |
-
"<div style='text-align: center; padding: 50px; color: #666;'>Click 'Process Image' to start</div>",
|
| 314 |
-
None,
|
| 315 |
-
"Image ready for processing"
|
| 316 |
-
),
|
| 317 |
-
inputs=[],
|
| 318 |
-
outputs=[html_output, side_by_side, status]
|
| 319 |
-
)
|
| 320 |
-
|
| 321 |
-
return demo
|
| 322 |
-
|
| 323 |
# ========== RUN THE APP ==========
|
| 324 |
# if __name__ == "__main__":
|
| 325 |
demo = main()
|
|
|
|
| 248 |
|
| 249 |
|
| 250 |
# ========== GRADIO INTERFACE ==========
|
| 251 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
# ========== RUN THE APP ==========
|
| 253 |
# if __name__ == "__main__":
|
| 254 |
demo = main()
|