atnikos commited on
Commit
7495dca
·
1 Parent(s): 64c1ade

retrieve adn edit

Browse files
Files changed (1) hide show
  1. app.py +44 -19
app.py CHANGED
@@ -60,6 +60,23 @@ WEBSITE = ("""<div class="embed_hidden" style="text-align: center;">
60
  </div>
61
  """)
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  @spaces.GPU
64
  def greet(n):
65
  print(zero.device) # <-- 'cuda:0' 🤗
@@ -164,30 +181,38 @@ def random_number():
164
 
165
  with gr.Blocks() as demo:
166
  gr.Markdown(WEBSITE)
167
-
 
 
 
 
168
  with gr.Row():
169
- with gr.Column(scale=8):
170
  retrieve_text = gr.Textbox(placeholder="Type the text for the motion you want to Retrieve:",
171
  show_label=True, label="Retrieval Text", value=DEFAULT_TEXT)
172
- with gr.Column(scale=1):
173
- clear_button_retrieval = gr.Button("Clear Retrieval Text")
174
-
175
- with gr.Row():
176
- with gr.Column(scale=8):
177
- input_text = gr.Textbox(placeholder="Type the edit text you want:",
178
- show_label=True, label="Input Text", value=DEFAULT_TEXT)
179
- with gr.Column(scale=1):
180
- clear_button_edit = gr.Button("Clear Edit Text")
181
 
 
 
 
 
182
  with gr.Row():
183
- video_output = gr.Video(label="Generated Video", height=240, width=320)
184
- retrieved_video_output = gr.Video(label="Retrieved Motion", height=240, width=320)
 
185
 
 
186
  with gr.Row():
187
- edit_button = gr.Button("Edit")
188
- retrieve_button = gr.Button("Retrieve")
 
 
 
 
189
 
190
- random_button = gr.Button("Random")
 
 
191
 
192
  def process_and_show_video(input_text):
193
  fname = show_video(input_text)
@@ -196,10 +221,10 @@ with gr.Blocks() as demo:
196
  def process_and_retrieve_video(input_text):
197
  fname = retrieve_video(input_text)
198
  return fname
199
-
200
- from gen_utils import read_config
201
- from retrieval_loader import load_model_from_cfg
202
  from retrieval_loader import get_tmr_model
 
 
203
  edit_button.click(process_and_show_video, inputs=input_text, outputs=video_output)
204
  retrieve_button.click(process_and_retrieve_video, inputs=retrieve_text, outputs=retrieved_video_output)
205
  # import ipdb;ipdb.set_trace()
 
60
  </div>
61
  """)
62
 
63
+
64
+ WEB_source = ("""<div class="embed_hidden" style="text-align: center;">
65
+ <h1>Pick a motion to edit!</h1>
66
+ <h3>
67
+ Here you should pick a source motion
68
+ </h3>
69
+ <hr class="double">
70
+ </div>
71
+ """)
72
+
73
+ WEB_target = ("""<div class="embed_hidden" style="text-align: center;">
74
+ <h1>Now type the text to edit that motion!</h1>
75
+ <h3>
76
+ Here you should get the generated motion!
77
+ </h3>
78
+ </div>
79
+ """)
80
  @spaces.GPU
81
  def greet(n):
82
  print(zero.device) # <-- 'cuda:0' 🤗
 
181
 
182
  with gr.Blocks() as demo:
183
  gr.Markdown(WEBSITE)
184
+ gr.Markdown(WEB_source)
185
+ # TODO load TMR text-encoder
186
+ # load motion embddings
187
+ # compute scores to check most similar ones with the text
188
+ # edit that motion!
189
  with gr.Row():
190
+ with gr.Column(scale=10):
191
  retrieve_text = gr.Textbox(placeholder="Type the text for the motion you want to Retrieve:",
192
  show_label=True, label="Retrieval Text", value=DEFAULT_TEXT)
193
+ xxx = 'https://motion-editing.s3.eu-central-1.amazonaws.com/collection_wo_walks_runs/rendered_pairs/011327_120_240-002682_120_240.mp4'
 
 
 
 
 
 
 
 
194
 
195
+ with gr.Column(scale=8):
196
+ retrieved_video_output = gr.Video(label="Retrieved Motion",
197
+ value=xxx,
198
+ height=360, width=480)
199
  with gr.Row():
200
+ clear_button_retrieval = gr.Button("Clear Retrieval Text")
201
+ retrieve_button = gr.Button("TMRetrieve")
202
+ random_button = gr.Button("Random")
203
 
204
+ gr.Markdown(WEB_target)
205
  with gr.Row():
206
+ with gr.Column(scale=8):
207
+ input_text = gr.Textbox(placeholder="Type the edit text you want:",
208
+ show_label=True, label="Input Text", value=DEFAULT_TEXT)
209
+ with gr.Row():
210
+ edit_button = gr.Button("Edit")
211
+ clear_button_edit = gr.Button("Clear Edit Text")
212
 
213
+ with gr.Column(scale=8):
214
+ video_output = gr.Video(label="Generated Video", height=360,
215
+ width=480)
216
 
217
  def process_and_show_video(input_text):
218
  fname = show_video(input_text)
 
221
  def process_and_retrieve_video(input_text):
222
  fname = retrieve_video(input_text)
223
  return fname
224
+
 
 
225
  from retrieval_loader import get_tmr_model
226
+ # load the dataset and splits
227
+
228
  edit_button.click(process_and_show_video, inputs=input_text, outputs=video_output)
229
  retrieve_button.click(process_and_retrieve_video, inputs=retrieve_text, outputs=retrieved_video_output)
230
  # import ipdb;ipdb.set_trace()