MrEmam commited on
Commit
d8dc65a
·
verified ·
1 Parent(s): b926bb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -2,15 +2,11 @@ import gradio as gr
2
  from PIL import Image
3
  from transformers import pipeline
4
 
5
- # Use Hugging Face pre-trained ESRGAN model
6
- sr = pipeline("image-to-image", model="eugenesiow/esrgan")
7
 
8
  def enhance(image: Image.Image):
9
- # Run ESRGAN on the input
10
  results = sr(image)
11
-
12
- # Hugging Face pipeline returns a list of dicts
13
- # Example: [{'generated_image': <PIL.Image.Image>}]
14
  enhanced_img = results[0]["generated_image"]
15
  return enhanced_img
16
 
@@ -18,8 +14,8 @@ iface = gr.Interface(
18
  fn=enhance,
19
  inputs=gr.Image(type="pil", label="Upload Photo"),
20
  outputs=gr.Image(type="pil", label="Enhanced Photo"),
21
- title="Free AI Photo Enhancer",
22
- description="Upload your photo and download the enhanced version (AI Super Resolution)."
23
  )
24
 
25
  iface.launch()
 
2
  from PIL import Image
3
  from transformers import pipeline
4
 
5
+ # Swin2SR super resolution model (x4 upscale)
6
+ sr = pipeline("image-to-image", model="caidas/swin2SR-classical-sr-x4-64")
7
 
8
  def enhance(image: Image.Image):
 
9
  results = sr(image)
 
 
 
10
  enhanced_img = results[0]["generated_image"]
11
  return enhanced_img
12
 
 
14
  fn=enhance,
15
  inputs=gr.Image(type="pil", label="Upload Photo"),
16
  outputs=gr.Image(type="pil", label="Enhanced Photo"),
17
+ title="AI Photo Enhancer",
18
+ description="Upload your photo and get an enhanced version (Super Resolution x4)."
19
  )
20
 
21
  iface.launch()