leonelhs commited on
Commit
9aa2121
β€’
1 Parent(s): 78e96ed
Files changed (3) hide show
  1. README.md +39 -9
  2. app.py +40 -0
  3. requirements.txt +5 -0
README.md CHANGED
@@ -1,13 +1,43 @@
1
  ---
2
- title: ZeroScratches
3
- emoji: πŸ‘
4
- colorFrom: purple
5
- colorTo: purple
6
- sdk: gradio
7
- sdk_version: 3.34.0
8
- app_file: app.py
9
- pinned: false
10
  license: mit
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
 
 
 
 
 
 
 
2
  license: mit
3
  ---
4
 
5
+ # Zero Scratches
6
+ ## Old Photo Restoration
7
+
8
+ This is a lightweight implementation of [Microsoft Bringing Old Photos Back to Life](https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life)
9
+
10
+
11
+ ### Install
12
+ ```shell
13
+ pip install zeroscatches
14
+ ```
15
+ ### Basic usage
16
+ ```python
17
+
18
+ import PIL.Image
19
+ from zeroscratches import EraseScratches
20
+
21
+
22
+ image_path = "/path/to/image-scratched.jpg"
23
+ eraser = EraseScratches()
24
+
25
+ image = PIL.Image.open(image_path)
26
+ new_img = eraser.erase(image)
27
+
28
+ new_img = PIL.Image.fromarray(new_img)
29
+ new_img.show()
30
+ ```
31
+
32
+ Get the pretrained models at [Hugging Face Zero Scratches](https://huggingface.co/leonelhs/zeroscratches)
33
+
34
+ ## Some Apps using the library:
35
+
36
+ ### [Face Shine](https://github.com/leonelhs/face-shine)
37
+ Face Shine Is a backend server for photo enhancement and restoration.
38
+
39
+ ### [Super Face](https://github.com/leonelhs/SuperFace/)
40
+ Super Face is a Python QT frontend for Face Shine server.
41
+
42
+ <img src="https://drive.google.com/uc?export=view&id=1D7hpjQSlUkzfTba-E5Ul4Rb1c8lYkFj5"/>
43
+ <img src="https://drive.google.com/uc?export=view&id=1oKpJe-Ff3SeEekhGVRP1Ap3eIFqt0c8u"/>
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import gradio as gr
4
+ from zeroscratches import EraseScratches
5
+
6
+ os.system("pip freeze")
7
+
8
+
9
+ def inference(img):
10
+ return EraseScratches().erase(img)
11
+
12
+
13
+ title = "Zero Scratches"
14
+ description = r"""
15
+ ## Old Photo Restoration
16
+
17
+ This is a lightweight implementation of [Microsoft Bringing Old Photos Back to Life](https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life)
18
+
19
+
20
+ """
21
+ article = r"""
22
+ If you have any question, please email πŸ“§ `[email protected]`.
23
+
24
+ This demo is running on a CPU, if you like this project please make us a donation to run on a GPU or just give us a ⭐ <a href='https://github.com/leonelhs/zeroscratches/' target='_blank'>Github</a>
25
+
26
+ <a href="https://www.buymeacoffee.com/leonelhs"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=leonelhs&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff" /></a>
27
+
28
+ <center><img src='https://visitor-badge.glitch.me/badge?page_id=hg.leonelhs.zeroscratches.visitor-badge' alt='visitor badge'></center>
29
+ """
30
+ demo = gr.Interface(
31
+ inference, [
32
+ gr.Image(type="pil", label="Input"),
33
+ ], [
34
+ gr.Image(type="numpy", label="Image zero scratches")
35
+ ],
36
+ title=title,
37
+ description=description,
38
+ article=article)
39
+
40
+ demo.queue().launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ torch>=2.0.1
2
+ zeroscratches
3
+
4
+
5
+