taesiri commited on
Commit
b49939e
1 Parent(s): c69d7bc
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +31 -15
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 💻
4
  colorFrom: blue
5
  colorTo: red
6
  sdk: gradio
7
- sdk_version: 3.0.5
8
  app_file: app.py
9
  pinned: true
10
  ---
 
4
  colorFrom: blue
5
  colorTo: red
6
  sdk: gradio
7
+ sdk_version: 4.13
8
  app_file: app.py
9
  pinned: true
10
  ---
app.py CHANGED
@@ -28,6 +28,15 @@ gdown.cached_download(
28
  md5="b1228503d5a89eef7e35e2cbf86b2fc0",
29
  )
30
 
 
 
 
 
 
 
 
 
 
31
  # EXTRACT
32
  torchvision.datasets.utils.extract_archive(
33
  from_path="GTA-V-Embeddings.zip",
@@ -35,13 +44,21 @@ torchvision.datasets.utils.extract_archive(
35
  remove_finished=False,
36
  )
37
 
38
- # Load videos from Dataset
39
- gta_v_videos = load_dataset("taesiri/GamePhysics_Grand_Theft_Auto_V")
 
 
 
 
 
 
 
 
 
40
  post_id_to_video_path = {
41
- os.path.splitext(os.path.basename(x))[0]: x
42
- for x in gta_v_videos["Grand_Theft_Auto_V"][:]["video_file_path"]
43
  }
44
- # Initialize CLIP model
45
  clip.available_models()
46
 
47
 
@@ -179,22 +196,22 @@ def main():
179
  value="A person flying in the air",
180
  label="Query",
181
  ),
182
- gr.Radio(list_of_games, label="Game To Search"),
183
- gr.Radio(["ViT-B/32"], label="MODEL"),
184
- gr.Radio(["Majority", "Top-K"], label="Aggregator"),
185
  gr.Slider(300, 2000, label="Pool Size", value=1000),
186
  ],
187
  outputs=[
188
- gr.Textbox(type="auto", label="Search Params"),
189
- gr.Video(type="mp4", label="Result 1"),
190
  gr.Markdown(),
191
- gr.Video(type="mp4", label="Result 2"),
192
  gr.Markdown(),
193
- gr.Video(type="mp4", label="Result 3"),
194
  gr.Markdown(),
195
- gr.Video(type="mp4", label="Result 4"),
196
  gr.Markdown(),
197
- gr.Video(type="mp4", label="Result 5"),
198
  gr.Markdown(),
199
  ],
200
  examples=[
@@ -244,7 +261,6 @@ def main():
244
 
245
  blocks.launch(
246
  debug=True,
247
- enable_queue=True,
248
  )
249
 
250
 
 
28
  md5="b1228503d5a89eef7e35e2cbf86b2fc0",
29
  )
30
 
31
+
32
+ gdown.cached_download(
33
+ url="https://huggingface.co/datasets/taesiri/GamePhysics_Grand_Theft_Auto_V/resolve/main/GTA-V-Videos.zip?download=true",
34
+ path="./GTA-V-Videos.zip",
35
+ quiet=False,
36
+ md5="14d8374a7d1f09c13b5c99fe4d0dc4f1",
37
+ )
38
+
39
+
40
  # EXTRACT
41
  torchvision.datasets.utils.extract_archive(
42
  from_path="GTA-V-Embeddings.zip",
 
44
  remove_finished=False,
45
  )
46
 
47
+
48
+ # EXTRACT
49
+ torchvision.datasets.utils.extract_archive(
50
+ from_path="GTA-V-Videos.zip",
51
+ to_path="./",
52
+ remove_finished=False,
53
+ )
54
+
55
+
56
+ list_of_all_videos = glob("GTA-V-Videos/*.mp4")
57
+
58
  post_id_to_video_path = {
59
+ os.path.splitext(os.path.basename(x))[0]: x for x in list_of_all_videos
 
60
  }
61
+
62
  clip.available_models()
63
 
64
 
 
196
  value="A person flying in the air",
197
  label="Query",
198
  ),
199
+ gr.Radio(list_of_games, label="Game To Search", value=list_of_games[0]),
200
+ gr.Radio(["ViT-B/32"], label="Model", value="ViT-B/32"),
201
+ gr.Radio(["Majority", "Top-K"], label="Aggregator", value="Majority"),
202
  gr.Slider(300, 2000, label="Pool Size", value=1000),
203
  ],
204
  outputs=[
205
+ gr.Textbox(label="Search Params"),
206
+ gr.Video(label="Result 1"),
207
  gr.Markdown(),
208
+ gr.Video(label="Result 2"),
209
  gr.Markdown(),
210
+ gr.Video(label="Result 3"),
211
  gr.Markdown(),
212
+ gr.Video(label="Result 4"),
213
  gr.Markdown(),
214
+ gr.Video(label="Result 5"),
215
  gr.Markdown(),
216
  ],
217
  examples=[
 
261
 
262
  blocks.launch(
263
  debug=True,
 
264
  )
265
 
266