Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
import torch.nn as nn
|
| 4 |
import torchvision.transforms as transforms
|
| 5 |
from PIL import Image
|
| 6 |
import numpy as np
|
| 7 |
-
import os
|
| 8 |
|
| 9 |
# Check if CUDA is available
|
| 10 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
@@ -111,10 +114,10 @@ def deblur_image(filepath):
|
|
| 111 |
print(f"Error processing image: {e}")
|
| 112 |
return None
|
| 113 |
|
| 114 |
-
# Custom CSS to hide fullscreen and share icons
|
| 115 |
custom_css = """
|
| 116 |
-
/* Hide fullscreen and share
|
| 117 |
-
|
| 118 |
display: none !important;
|
| 119 |
}
|
| 120 |
/* Hide Gradio's footer and header */
|
|
@@ -150,7 +153,7 @@ body, .gradio-container {
|
|
| 150 |
}
|
| 151 |
"""
|
| 152 |
|
| 153 |
-
# Gradio interface
|
| 154 |
demo = gr.Interface(
|
| 155 |
fn=deblur_image,
|
| 156 |
inputs=gr.File(label="Input", type="filepath"),
|
|
@@ -160,6 +163,6 @@ demo = gr.Interface(
|
|
| 160 |
css=custom_css
|
| 161 |
)
|
| 162 |
|
| 163 |
-
# Launch Gradio app
|
| 164 |
if __name__ == "__main__":
|
| 165 |
demo.launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import warnings
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
import gradio as gr
|
| 6 |
import torch
|
| 7 |
import torch.nn as nn
|
| 8 |
import torchvision.transforms as transforms
|
| 9 |
from PIL import Image
|
| 10 |
import numpy as np
|
|
|
|
| 11 |
|
| 12 |
# Check if CUDA is available
|
| 13 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
|
|
|
| 114 |
print(f"Error processing image: {e}")
|
| 115 |
return None
|
| 116 |
|
| 117 |
+
# ✅ Custom CSS to hide fullscreen and share icons
|
| 118 |
custom_css = """
|
| 119 |
+
/* Hide fullscreen and share buttons */
|
| 120 |
+
button[title="Fullscreen"], button[title="Share"] {
|
| 121 |
display: none !important;
|
| 122 |
}
|
| 123 |
/* Hide Gradio's footer and header */
|
|
|
|
| 153 |
}
|
| 154 |
"""
|
| 155 |
|
| 156 |
+
# ✅ Gradio interface
|
| 157 |
demo = gr.Interface(
|
| 158 |
fn=deblur_image,
|
| 159 |
inputs=gr.File(label="Input", type="filepath"),
|
|
|
|
| 163 |
css=custom_css
|
| 164 |
)
|
| 165 |
|
| 166 |
+
# ✅ Launch Gradio app
|
| 167 |
if __name__ == "__main__":
|
| 168 |
demo.launch()
|