taesiri commited on
Commit
b0bbd84
·
1 Parent(s): 18a2d8e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -115,10 +115,15 @@ def gradio_search(query, game_name, selected_model, aggregator, pool_size, k=6):
115
 
116
  results = []
117
  relevant_videos = searcher.search_top_k(query, k=k, pool_size=pool_size, search_mod=aggregator)
 
 
118
  params = ', '.join(map(str, [query, game_name, selected_model, aggregator, pool_size]))
119
  results.append(params)
120
- results.extend(relevant_videos)
121
- print(results)
 
 
 
122
  return results
123
 
124
  list_of_games = ['Grand Theft Auto V']
@@ -141,10 +146,16 @@ iface = gr.Interface(fn=gradio_search,
141
  outputs=[
142
  gr.outputs.Textbox(type="auto", label='Search Params'),
143
  gr.outputs.Video(type='mp4', label='Result 1'),
 
144
  gr.outputs.Video(type='mp4', label='Result 2'),
 
145
  gr.outputs.Video(type='mp4', label='Result 3'),
 
146
  gr.outputs.Video(type='mp4', label='Result 4'),
147
- gr.outputs.Video(type='mp4', label='Result 5')],
 
 
 
148
  examples=[
149
  ["A red car", list_of_games[0], 'ViT-B/32', 'Top-K', 1000],
150
  ["A person wearing pink", list_of_games[0], 'ViT-B/32', 'Top-K', 1000],
 
115
 
116
  results = []
117
  relevant_videos = searcher.search_top_k(query, k=k, pool_size=pool_size, search_mod=aggregator)
118
+
119
+
120
  params = ', '.join(map(str, [query, game_name, selected_model, aggregator, pool_size]))
121
  results.append(params)
122
+
123
+ for v in relevant_videos:
124
+ results.append(v)
125
+ sid = v.split('/')[-1].split('.')[0]
126
+ results.append(f"https://www.reddit.com/r/GamePhysics/comments/{sid}/")
127
  return results
128
 
129
  list_of_games = ['Grand Theft Auto V']
 
146
  outputs=[
147
  gr.outputs.Textbox(type="auto", label='Search Params'),
148
  gr.outputs.Video(type='mp4', label='Result 1'),
149
+ gr.outputs.Textbox(type="auto", label='Submission URL - Result 1'),
150
  gr.outputs.Video(type='mp4', label='Result 2'),
151
+ gr.outputs.Textbox(type="auto", label='Submission URL - Result 2'),
152
  gr.outputs.Video(type='mp4', label='Result 3'),
153
+ gr.outputs.Textbox(type="auto", label='Submission URL - Result 3'),
154
  gr.outputs.Video(type='mp4', label='Result 4'),
155
+ gr.outputs.Textbox(type="auto", label='Submission URL - Result 4'),
156
+ gr.outputs.Video(type='mp4', label='Result 5'),
157
+ gr.outputs.Textbox(type="auto", label='Submission URL - Result 5'),
158
+ ],
159
  examples=[
160
  ["A red car", list_of_games[0], 'ViT-B/32', 'Top-K', 1000],
161
  ["A person wearing pink", list_of_games[0], 'ViT-B/32', 'Top-K', 1000],