gunateja commited on
Commit
6dd6101
·
verified ·
1 Parent(s): 7dfc11f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -5,7 +5,7 @@ import numpy as np
5
  from PIL import Image
6
  import io
7
 
8
- # Load pre-trained deblurring model
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
- # Predict with the model
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()