Pie31415 commited on
Commit
f9c9568
·
1 Parent(s): 27bf9a9

updated app

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -198,6 +198,11 @@ def video_inference(
198
 
199
  return "avatar.gif"
200
 
 
 
 
 
 
201
  description = """<p style='text-align: center'> Create a personal avatar from just a single image using ROME. <br> <a href='https://arxiv.org/abs/2206.08343' target='_blank'>Paper</a> | <a href='https://samsunglabs.github.io/rome' target='_blank'>Project Page</a> | <a href='https://github.com/SamsungLabs/rome' target='_blank'>Github</a> </p>"""
202
  quote = """
203
  > <p style='text-align: center'> [The] system creates realistic mesh-based avatars from a single <strong>source</strong> photo. These avatars are rigged, i.e., they can be driven by the animation parameters from a different <strong>driving</strong> frame. </p>"""
@@ -217,9 +222,10 @@ with gr.Blocks() as demo:
217
  with gr.Tab("Video Inference"):
218
  with gr.Row():
219
  source_img2 = gr.Image(type="pil", label="Source image", show_label=True)
220
- driver_vid = gr.Video(label="Driver video")
221
  video_output = gr.Image(label="Rendered GIF avatar")
222
  video_button = gr.Button("Predict")
 
223
 
224
  gr.Examples(
225
  examples=[
@@ -234,5 +240,6 @@ with gr.Blocks() as demo:
234
 
235
  image_button.click(image_inference, inputs=[source_img, driver_img], outputs=image_output)
236
  video_button.click(video_inference, inputs=[source_img2, driver_vid], outputs=video_output)
 
237
 
238
  demo.launch()
 
198
 
199
  return "avatar.gif"
200
 
201
+ upload = True
202
+
203
+ def toggle_webcam():
204
+ upload = not upload
205
+
206
  description = """<p style='text-align: center'> Create a personal avatar from just a single image using ROME. <br> <a href='https://arxiv.org/abs/2206.08343' target='_blank'>Paper</a> | <a href='https://samsunglabs.github.io/rome' target='_blank'>Project Page</a> | <a href='https://github.com/SamsungLabs/rome' target='_blank'>Github</a> </p>"""
207
  quote = """
208
  > <p style='text-align: center'> [The] system creates realistic mesh-based avatars from a single <strong>source</strong> photo. These avatars are rigged, i.e., they can be driven by the animation parameters from a different <strong>driving</strong> frame. </p>"""
 
222
  with gr.Tab("Video Inference"):
223
  with gr.Row():
224
  source_img2 = gr.Image(type="pil", label="Source image", show_label=True)
225
+ driver_vid = gr.Video(label="Driver video", source= "upload" if upload else "webcam" )
226
  video_output = gr.Image(label="Rendered GIF avatar")
227
  video_button = gr.Button("Predict")
228
+ toggle_cam = gr.Button("Toggle Webcam")
229
 
230
  gr.Examples(
231
  examples=[
 
240
 
241
  image_button.click(image_inference, inputs=[source_img, driver_img], outputs=image_output)
242
  video_button.click(video_inference, inputs=[source_img2, driver_vid], outputs=video_output)
243
+ toggle_cam.click(toggle_webcam)
244
 
245
  demo.launch()