Spaces:
Configuration error
Configuration error
englert
commited on
Commit
·
96fcaf6
1
Parent(s):
0dc92b3
update app.py # 7
Browse files
app.py
CHANGED
|
@@ -1,26 +1,26 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import shutil
|
| 3 |
-
import zipfile
|
| 4 |
-
from os.path import join, isfile, basename
|
| 5 |
-
|
| 6 |
-
import cv2
|
| 7 |
-
import numpy as np
|
| 8 |
import gradio as gr
|
| 9 |
-
import torch
|
| 10 |
-
|
| 11 |
-
from resnet50 import resnet18
|
| 12 |
-
from sampling_util import furthest_neighbours
|
| 13 |
-
from video_reader import video_reader
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def predict(input_file, downsample_size):
|
|
@@ -76,11 +76,11 @@ def predict(input_file, downsample_size):
|
|
| 76 |
# isfile(join(selected_directory, f))]
|
| 77 |
|
| 78 |
zip_path = "asd.zip"
|
| 79 |
-
zipf = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
|
| 80 |
-
# for i, f in enumerate(all_selected_imgs_path):
|
| 81 |
-
# zipf.write(f, basename(f))
|
| 82 |
-
zipf.close()
|
| 83 |
-
print("selected images zipped")
|
| 84 |
|
| 85 |
return zip_path
|
| 86 |
|
|
|
|
| 1 |
+
# import os
|
| 2 |
+
# import shutil
|
| 3 |
+
# import zipfile
|
| 4 |
+
# from os.path import join, isfile, basename
|
| 5 |
+
#
|
| 6 |
+
# import cv2
|
| 7 |
+
# import numpy as np
|
| 8 |
import gradio as gr
|
| 9 |
+
# import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
# from resnet50 import resnet18
|
| 12 |
+
# from sampling_util import furthest_neighbours
|
| 13 |
+
# from video_reader import video_reader
|
| 14 |
+
#
|
| 15 |
+
# model = resnet18(
|
| 16 |
+
# output_dim=0,
|
| 17 |
+
# nmb_prototypes=0,
|
| 18 |
+
# eval_mode=True,
|
| 19 |
+
# hidden_mlp=0,
|
| 20 |
+
# normalize=False)
|
| 21 |
+
# model.load_state_dict(torch.load("model.pt"))
|
| 22 |
+
# model.eval()
|
| 23 |
+
# avg_pool = torch.nn.AdaptiveAvgPool2d((1, 1))
|
| 24 |
|
| 25 |
|
| 26 |
def predict(input_file, downsample_size):
|
|
|
|
| 76 |
# isfile(join(selected_directory, f))]
|
| 77 |
|
| 78 |
zip_path = "asd.zip"
|
| 79 |
+
# zipf = zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED)
|
| 80 |
+
# # for i, f in enumerate(all_selected_imgs_path):
|
| 81 |
+
# # zipf.write(f, basename(f))
|
| 82 |
+
# zipf.close()
|
| 83 |
+
# print("selected images zipped")
|
| 84 |
|
| 85 |
return zip_path
|
| 86 |
|