Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,14 +11,19 @@ from transformers import AutoProcessor, AutoModelForCausalLM
|
|
| 11 |
from gradio_imageslider import ImageSlider
|
| 12 |
from PIL import Image
|
| 13 |
from huggingface_hub import snapshot_download
|
| 14 |
-
import requests
|
|
|
|
|
|
|
|
|
|
| 15 |
try:
|
| 16 |
from basicsr.archs.rrdbnet_arch import RRDBNet
|
| 17 |
from basicsr.utils import img2tensor, tensor2img
|
| 18 |
USE_ESRGAN = True
|
| 19 |
except ImportError:
|
| 20 |
USE_ESRGAN = False
|
| 21 |
-
warnings.warn("basicsr not installed; falling back to LANCZOS interpolation.")
|
|
|
|
|
|
|
| 22 |
#col-container {
|
| 23 |
margin: 0 auto;
|
| 24 |
max-width: 800px;
|
|
@@ -27,7 +32,9 @@ except ImportError:
|
|
| 27 |
text-align: center;
|
| 28 |
margin-bottom: 2rem;
|
| 29 |
}
|
| 30 |
-
"""
|
|
|
|
|
|
|
| 31 |
if torch.cuda.is_available():
|
| 32 |
power_device = "GPU"
|
| 33 |
device = "cuda"
|
|
|
|
| 11 |
from gradio_imageslider import ImageSlider
|
| 12 |
from PIL import Image
|
| 13 |
from huggingface_hub import snapshot_download
|
| 14 |
+
import requests
|
| 15 |
+
import io
|
| 16 |
+
|
| 17 |
+
# For ESRGAN (requires pip install basicsr gfpgan)
|
| 18 |
try:
|
| 19 |
from basicsr.archs.rrdbnet_arch import RRDBNet
|
| 20 |
from basicsr.utils import img2tensor, tensor2img
|
| 21 |
USE_ESRGAN = True
|
| 22 |
except ImportError:
|
| 23 |
USE_ESRGAN = False
|
| 24 |
+
warnings.warn("basicsr not installed; falling back to LANCZOS interpolation.")
|
| 25 |
+
|
| 26 |
+
css = """
|
| 27 |
#col-container {
|
| 28 |
margin: 0 auto;
|
| 29 |
max-width: 800px;
|
|
|
|
| 32 |
text-align: center;
|
| 33 |
margin-bottom: 2rem;
|
| 34 |
}
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
# Device setup
|
| 38 |
if torch.cuda.is_available():
|
| 39 |
power_device = "GPU"
|
| 40 |
device = "cuda"
|