Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
800e571
1
Parent(s):
8a36508
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,9 @@ import gradio as gr
|
|
20 |
import torch
|
21 |
import zipfile
|
22 |
import os
|
23 |
-
os.system('wget https://
|
|
|
|
|
24 |
|
25 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2017/09/11/15/58/sunset-2739472_1280.jpg', 'sunset.jpg')
|
26 |
|
@@ -28,10 +30,10 @@ torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2017/09/11/15/58/s
|
|
28 |
with zipfile.ZipFile('apple-neural-hash.zip', 'r') as zip_ref:
|
29 |
zip_ref.extractall('.')
|
30 |
# Load ONNX model
|
31 |
-
session = onnxruntime.InferenceSession('
|
32 |
|
33 |
# Load output hash matrix
|
34 |
-
seed1 = open('
|
35 |
seed1 = np.frombuffer(seed1, dtype=np.float32)
|
36 |
seed1 = seed1.reshape([96, 128])
|
37 |
|
|
|
20 |
import torch
|
21 |
import zipfile
|
22 |
import os
|
23 |
+
os.system('wget https://www.dropbox.com/s/ggf6ok63u7hywhc/neuralhash_128x96_seed1.dat')
|
24 |
+
os.system('wget https://www.dropbox.com/s/1jug4wtevz1rol0/model.onnx')
|
25 |
+
|
26 |
|
27 |
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2017/09/11/15/58/sunset-2739472_1280.jpg', 'sunset.jpg')
|
28 |
|
|
|
30 |
with zipfile.ZipFile('apple-neural-hash.zip', 'r') as zip_ref:
|
31 |
zip_ref.extractall('.')
|
32 |
# Load ONNX model
|
33 |
+
session = onnxruntime.InferenceSession('model.onnx')
|
34 |
|
35 |
# Load output hash matrix
|
36 |
+
seed1 = open('neuralhash_128x96_seed1.dat', 'rb').read()[128:]
|
37 |
seed1 = np.frombuffer(seed1, dtype=np.float32)
|
38 |
seed1 = seed1.reshape([96, 128])
|
39 |
|