nielsr HF staff commited on
Commit
dfbdbbb
Β·
1 Parent(s): ce1585a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -5,6 +5,15 @@ import os
5
  import torch
6
  from transformers import AutoImageProcessor, Swin2SRForImageSuperResolution
7
 
 
 
 
 
 
 
 
 
 
8
  processor = AutoImageProcessor.from_pretrained("caidas/swin2SR-classical-sr-x2-64")
9
  model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-classical-sr-x2-64")
10
 
@@ -23,19 +32,16 @@ def enhance(image):
23
 
24
  return Image.fromarray(output)
25
 
26
- title = "Swin2SR demo for Image Super-Resolution πŸš€πŸš€πŸ”₯"
27
  description = '''
28
 
29
- **This Demo expects low-quality and low-resolution JPEG compressed images, in the near future we will support any kind of input**
30
-
31
- **We are looking for collaborators! Collaboratorλ₯Ό μ°Ύκ³  μžˆμŠ΅λ‹ˆλ‹€!** πŸ‡¬πŸ‡§ πŸ‡ͺπŸ‡Έ πŸ‡°πŸ‡· πŸ‡«πŸ‡· πŸ‡·πŸ‡΄ πŸ‡©πŸ‡ͺ πŸ‡¨πŸ‡³
32
 
33
- **Please check our github project: https://github.com/mv-lab/swin2sr or paper: https://arxiv.org/abs/2209.11345 feel free to contact us**
34
-
35
- **Demos also available at [google colab](https://colab.research.google.com/drive/1paPrt62ydwLv2U2eZqfcFsePI4X4WRR1?usp=sharing) and [Kaggle](https://www.kaggle.com/code/jesucristo/super-resolution-demo-swin2sr-official/)**
36
- </br>
37
  '''
38
- article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2209.11345' target='_blank'>Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration</a> | <a href='https://github.com/mv-lab/swin2sr' target='_blank'>Github Repo</a></p>"
 
 
39
 
40
  gr.Interface(
41
  enhance,
@@ -44,4 +50,5 @@ gr.Interface(
44
  title=title,
45
  description=description,
46
  article=article,
 
47
  ).launch(enable_queue=True)
 
5
  import torch
6
  from transformers import AutoImageProcessor, Swin2SRForImageSuperResolution
7
 
8
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/00003.jpg', '00003.jpg')
9
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/0855.jpg', '0855.jpg')
10
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/ali_eye.jpg', 'ali_eye.jpg')
11
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/butterfly.jpg', 'butterfly.jpg')
12
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/chain-eye.jpg', 'chain-eye.jpg')
13
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/gojou-eyes.jpg', 'gojou-eyes.jpg')
14
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/shanghai.jpg', 'shanghai.jpg')
15
+ torch.hub.download_url_to_file('https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/vagabond.jpg', 'vagabond.jpg')
16
+
17
  processor = AutoImageProcessor.from_pretrained("caidas/swin2SR-classical-sr-x2-64")
18
  model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-classical-sr-x2-64")
19
 
 
32
 
33
  return Image.fromarray(output)
34
 
35
+ title = "Demo: Swin2SR for Image Super-Resolution πŸš€πŸš€πŸ”₯"
36
  description = '''
37
 
38
+ **This demo expects low-quality and low-resolution JPEG compressed images.**
 
 
39
 
40
+ **Demo notebook can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Swin2SR/Perform_image_super_resolution_with_Swin2SR.ipynb).
 
 
 
41
  '''
42
+ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2209.11345' target='_blank'>Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration</a> | <a href='https://huggingface.co/docs/transformers/main/model_doc/swin2sr' target='_blank'>HuggingFace docs</a></p>"
43
+
44
+ examples = [['00003.jpg'], ['0855.jpg'], ['ali_eye.jpg'], ['butterfly.jpg'], ['chain-eye.jpg'], ['gojou-eyes.jpg'], ['shanghai.jpg'], ['vagabond.jpg']]
45
 
46
  gr.Interface(
47
  enhance,
 
50
  title=title,
51
  description=description,
52
  article=article,
53
+ examples=examples,
54
  ).launch(enable_queue=True)