Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from huggingface_hub import from_pretrained_keras
|
| 2 |
+
from PIL import Image
|
| 3 |
+
|
| 4 |
+
import tensorflow as tf
|
| 5 |
+
import numpy as np
|
| 6 |
+
import requests
|
| 7 |
+
|
| 8 |
+
url = "https://github.com/sayakpaul/maxim-tf/raw/main/images/Denoising/input/0011_23.png"
|
| 9 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
| 10 |
+
image = np.array(image)
|
| 11 |
+
image = tf.convert_to_tensor(image)
|
| 12 |
+
image = tf.image.resize(image, (256, 256))
|
| 13 |
+
|
| 14 |
+
model = from_pretrained_keras("google/maxim-s3-denoising-sidd")
|
| 15 |
+
predictions = model.predict(tf.expand_dims(image, 0))
|