pratyyush commited on
Commit
d0d2317
·
verified ·
1 Parent(s): 463f23f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -22
app.py CHANGED
@@ -2,38 +2,75 @@ import os
2
  import gradio as gr
3
  from zeroscratches import EraseScratches
4
 
 
5
  os.system("pip freeze")
6
 
7
-
8
  def predict(img):
 
9
  return EraseScratches().erase(img)
10
 
 
 
 
 
 
 
 
11
 
12
- title = "Zero Scratches"
13
- description = r"""
14
- ## Old Photo Restoration
15
-
16
- This is a lightweight implementation of [Microsoft Bringing Old Photos Back to Life](https://github.com/microsoft/Bringing-Old-Photos-Back-to-Life)
17
- """
 
 
 
 
18
 
19
- article = r"""
20
- Questions, doubts, comments, please email 📧 `leonelhs@gmail.com`
 
 
21
 
22
- 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>
 
 
 
 
 
23
 
24
- <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>
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- <center><img src='https://visitor-badge.glitch.me/badge?page_id=zeroscratches.visitor-badge' alt='visitor badge'></center>
 
 
 
 
 
27
  """
28
 
 
29
  demo = gr.Interface(
30
- predict, [
31
- gr.Image(type="pil", label="Input"),
32
- ], [
33
- gr.Image(type="numpy", label="Image zero scratches")
34
- ],
35
- title=title,
36
- description=description,
37
- article=article)
38
-
39
- demo.queue().launch()
 
2
  import gradio as gr
3
  from zeroscratches import EraseScratches
4
 
5
+ # ✅ Install dependencies (if not already installed)
6
  os.system("pip freeze")
7
 
8
+ # ✅ Inference function
9
  def predict(img):
10
+ """ Apply scratch removal on image """
11
  return EraseScratches().erase(img)
12
 
13
+ # ✅ Custom CSS for clean design
14
+ custom_css = """
15
+ /* Dark theme styling */
16
+ body, .gradio-container {
17
+ background-color: #000000 !important;
18
+ color: white !important;
19
+ }
20
 
21
+ /* Styling for buttons */
22
+ .gr-button {
23
+ background: #1e90ff !important;
24
+ color: white !important;
25
+ border: none !important;
26
+ padding: 10px 20px !important;
27
+ font-size: 14px !important;
28
+ width: 100% !important;
29
+ cursor: pointer;
30
+ }
31
 
32
+ /* Hover effect */
33
+ .gr-button:hover {
34
+ background: #0056b3 !important;
35
+ }
36
 
37
+ /* Styling for output boxes */
38
+ .gr-box, .gr-input, .gr-output {
39
+ background-color: #1c1c1c !important;
40
+ color: white !important;
41
+ border: 1px solid #333333 !important;
42
+ }
43
 
44
+ /* Hide Gradio footer and header folders */
45
+ footer, header, .gradio-footer, .gradio-header,
46
+ #footer, #header, #description,
47
+ .svelte-1i4i8j8, .svelte-1lcdy9p, .svelte-18k01vx,
48
+ .svelte-1qtpyo7, .svelte-1xjlq5, .svelte-1g01jrn,
49
+ .svelte-1rs4uyx, .gradio-branding,
50
+ #share-btn, #share, #download-btn, #download,
51
+ .gradio-flag, .gradio-screenshot,
52
+ .gradio-tab, .gradio-tabs,
53
+ .gradio-tabs-wrapper,
54
+ .gradio-header__space {
55
+ display: none !important;
56
+ }
57
 
58
+ /* Make images non-draggable */
59
+ img {
60
+ pointer-events: none !important;
61
+ -webkit-user-drag: none !important;
62
+ user-select: none !important;
63
+ }
64
  """
65
 
66
+ # ✅ Gradio Interface with Clean UI
67
  demo = gr.Interface(
68
+ fn=predict,
69
+ inputs=[gr.Image(type="pil", label="Input")],
70
+ outputs=[gr.Image(type="numpy", label="Restored Image")],
71
+ title="Restore",
72
+ css=custom_css
73
+ )
74
+
75
+ # ✅ Launch Gradio app
76
+ demo.queue().launch(debug=True)