Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,13 +21,9 @@ enable_gpu = torch.cuda.is_available()
|
|
21 |
map_location = torch.device("cuda") if enable_gpu else "cpu"
|
22 |
from huggingface_hub import hf_hub_download
|
23 |
from fastai.learner import load_learner
|
24 |
-
import tensorflow as tf
|
25 |
|
26 |
model = torch.load("h2z-85epoch.pth",map_location=torch.device('cpu'))
|
27 |
def generate_img(img_path):
|
28 |
-
img = tf.io.read_file(img_path)
|
29 |
-
img = tf.image.decode_png(img)
|
30 |
-
img = tf.expand_dims(img, axis=0)
|
31 |
prediction = model(img, training=False)
|
32 |
return prediction
|
33 |
|
|
|
21 |
map_location = torch.device("cuda") if enable_gpu else "cpu"
|
22 |
from huggingface_hub import hf_hub_download
|
23 |
from fastai.learner import load_learner
|
|
|
24 |
|
25 |
model = torch.load("h2z-85epoch.pth",map_location=torch.device('cpu'))
|
26 |
def generate_img(img_path):
|
|
|
|
|
|
|
27 |
prediction = model(img, training=False)
|
28 |
return prediction
|
29 |
|