Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,15 @@
|
|
1 |
-
# app.py
|
2 |
|
3 |
import gradio as gr
|
4 |
-
from
|
5 |
-
from PIL import Image
|
6 |
-
import torch
|
7 |
|
8 |
-
# Load model
|
9 |
-
|
10 |
-
model = RealESRGAN(device, scale=2)
|
11 |
-
model.load_weights('weights/RealESRGAN_x2.pth') # nanti download dari huggingface atau official
|
12 |
|
13 |
-
def enhance_image(
|
14 |
-
|
|
|
|
|
15 |
return output_image
|
16 |
|
17 |
-
|
18 |
-
gr.Interface(fn=enhance_image, inputs=gr.Image(), outputs=gr.Image()).launch()
|
|
|
1 |
+
# app.py (Versi Fix)
|
2 |
|
3 |
import gradio as gr
|
4 |
+
from super_image import EdsrModel, ImageLoader
|
|
|
|
|
5 |
|
6 |
+
# Load model dari Hugging Face
|
7 |
+
model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=2)
|
|
|
|
|
8 |
|
9 |
+
def enhance_image(image):
|
10 |
+
inputs = ImageLoader.load_image(image).unsqueeze(0)
|
11 |
+
preds = model(inputs)
|
12 |
+
output_image = ImageLoader.save_image(preds)
|
13 |
return output_image
|
14 |
|
15 |
+
gr.Interface(fn=enhance_image, inputs=gr.Image(type="pil"), outputs=gr.Image(type="pil")).launch()
|
|