Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import numpy as np
|
|
5 |
from PIL import Image
|
6 |
import io
|
7 |
|
8 |
-
# Load
|
9 |
model = from_pretrained_keras("google/maxim-s3-deblurring-reds")
|
10 |
|
11 |
def deblur_image(input_image):
|
@@ -14,10 +14,10 @@ def deblur_image(input_image):
|
|
14 |
image = tf.convert_to_tensor(image)
|
15 |
image = tf.image.resize(image, (256, 256))
|
16 |
|
17 |
-
#
|
18 |
predictions = model.predict(tf.expand_dims(image, 0))
|
19 |
|
20 |
-
# Convert back to image
|
21 |
output_image = predictions[0].numpy().astype(np.uint8)
|
22 |
output_image = Image.fromarray(output_image)
|
23 |
|
@@ -35,4 +35,4 @@ iface = gr.Interface(fn=deblur_image,
|
|
35 |
live=True)
|
36 |
|
37 |
# Launch the Gradio interface
|
38 |
-
iface.launch()
|
|
|
5 |
from PIL import Image
|
6 |
import io
|
7 |
|
8 |
+
# Load the model from Hugging Face Hub using from_pretrained_keras
|
9 |
model = from_pretrained_keras("google/maxim-s3-deblurring-reds")
|
10 |
|
11 |
def deblur_image(input_image):
|
|
|
14 |
image = tf.convert_to_tensor(image)
|
15 |
image = tf.image.resize(image, (256, 256))
|
16 |
|
17 |
+
# Make predictions with the model
|
18 |
predictions = model.predict(tf.expand_dims(image, 0))
|
19 |
|
20 |
+
# Convert the prediction back to an image
|
21 |
output_image = predictions[0].numpy().astype(np.uint8)
|
22 |
output_image = Image.fromarray(output_image)
|
23 |
|
|
|
35 |
live=True)
|
36 |
|
37 |
# Launch the Gradio interface
|
38 |
+
iface.launch()
|