Spaces:
Running
Running
fix rendering and args in textboxes
Browse files- app.py +12 -9
- renderer/humor.py +2 -3
app.py
CHANGED
|
@@ -265,8 +265,9 @@ def create_gradio_interface():
|
|
| 265 |
random_key = random.choice(list(current_set.keys()))
|
| 266 |
motion = current_set[random_key]['motion_a']
|
| 267 |
text_annot = current_set[random_key]['annotation']
|
|
|
|
| 268 |
return gr.update(value=motion,
|
| 269 |
-
visible=True),
|
| 270 |
|
| 271 |
def clear():
|
| 272 |
return ""
|
|
@@ -302,22 +303,24 @@ def create_gradio_interface():
|
|
| 302 |
width=480,
|
| 303 |
visible=False # Initially hidden
|
| 304 |
)
|
| 305 |
-
gr.
|
|
|
|
|
|
|
| 306 |
with gr.Row():
|
| 307 |
# First example
|
| 308 |
with gr.Column():
|
| 309 |
gr.Video(value=example_videos[0],
|
| 310 |
height=180,width=240,
|
| 311 |
label="Example 1")
|
| 312 |
-
example_button1 = gr.Button("Select
|
| 313 |
-
|
| 314 |
|
| 315 |
# Second example
|
| 316 |
with gr.Column():
|
| 317 |
gr.Video(value=example_videos[1],
|
| 318 |
height=180,width=240,
|
| 319 |
label="Example 2")
|
| 320 |
-
example_button2 = gr.Button("Select
|
| 321 |
elem_classes=["fit-text"])
|
| 322 |
with gr.Row():
|
| 323 |
|
|
@@ -326,7 +329,7 @@ def create_gradio_interface():
|
|
| 326 |
gr.Video(value=example_videos[2],
|
| 327 |
height=180,width=240,
|
| 328 |
label="Example 3")
|
| 329 |
-
example_button3 = gr.Button("Select
|
| 330 |
elem_classes=["fit-text"])
|
| 331 |
|
| 332 |
# Fourth example
|
|
@@ -334,7 +337,7 @@ def create_gradio_interface():
|
|
| 334 |
gr.Video(value=example_videos[3],
|
| 335 |
height=180,width=240,
|
| 336 |
label="Example 4")
|
| 337 |
-
example_button4 = gr.Button("Select
|
| 338 |
elem_classes=["fit-text"])
|
| 339 |
|
| 340 |
with gr.Column(scale=5):
|
|
@@ -381,7 +384,7 @@ def create_gradio_interface():
|
|
| 381 |
# Update all outputs
|
| 382 |
return (
|
| 383 |
gr.update(value=example_video, visible=True), # Update video output
|
| 384 |
-
example_text, # Update suggested edit text
|
| 385 |
example_key, # Update random key state
|
| 386 |
example_text # Update input text
|
| 387 |
)
|
|
@@ -446,7 +449,7 @@ CUSTOM_CSS = """
|
|
| 446 |
button.fit-text {
|
| 447 |
width: auto; /* Automatically adjusts to the text length */
|
| 448 |
padding: 10px 20px; /* Adjust padding for a better look */
|
| 449 |
-
font-size:
|
| 450 |
text-align: center; /* Center the text */
|
| 451 |
margin: 0 auto; /* Center the button horizontally */
|
| 452 |
display: inline-block; /* Prevent it from stretching */
|
|
|
|
| 265 |
random_key = random.choice(list(current_set.keys()))
|
| 266 |
motion = current_set[random_key]['motion_a']
|
| 267 |
text_annot = current_set[random_key]['annotation']
|
| 268 |
+
# should add one more text_annot
|
| 269 |
return gr.update(value=motion,
|
| 270 |
+
visible=True), random_key, text_annot
|
| 271 |
|
| 272 |
def clear():
|
| 273 |
return ""
|
|
|
|
| 303 |
width=480,
|
| 304 |
visible=False # Initially hidden
|
| 305 |
)
|
| 306 |
+
gr.HTML(("""<div class="embed_hidden" style="text-align: center;">
|
| 307 |
+
<h1>Examples</h1></div>"""))
|
| 308 |
+
|
| 309 |
with gr.Row():
|
| 310 |
# First example
|
| 311 |
with gr.Column():
|
| 312 |
gr.Video(value=example_videos[0],
|
| 313 |
height=180,width=240,
|
| 314 |
label="Example 1")
|
| 315 |
+
example_button1 = gr.Button("Select Ex. 1",
|
| 316 |
+
elem_classes=["fit-text"])
|
| 317 |
|
| 318 |
# Second example
|
| 319 |
with gr.Column():
|
| 320 |
gr.Video(value=example_videos[1],
|
| 321 |
height=180,width=240,
|
| 322 |
label="Example 2")
|
| 323 |
+
example_button2 = gr.Button("Select Ex. 2",
|
| 324 |
elem_classes=["fit-text"])
|
| 325 |
with gr.Row():
|
| 326 |
|
|
|
|
| 329 |
gr.Video(value=example_videos[2],
|
| 330 |
height=180,width=240,
|
| 331 |
label="Example 3")
|
| 332 |
+
example_button3 = gr.Button("Select Ex. 3",
|
| 333 |
elem_classes=["fit-text"])
|
| 334 |
|
| 335 |
# Fourth example
|
|
|
|
| 337 |
gr.Video(value=example_videos[3],
|
| 338 |
height=180,width=240,
|
| 339 |
label="Example 4")
|
| 340 |
+
example_button4 = gr.Button("Select Ex. 4",
|
| 341 |
elem_classes=["fit-text"])
|
| 342 |
|
| 343 |
with gr.Column(scale=5):
|
|
|
|
| 384 |
# Update all outputs
|
| 385 |
return (
|
| 386 |
gr.update(value=example_video, visible=True), # Update video output
|
| 387 |
+
# example_text, # Update suggested edit text
|
| 388 |
example_key, # Update random key state
|
| 389 |
example_text # Update input text
|
| 390 |
)
|
|
|
|
| 449 |
button.fit-text {
|
| 450 |
width: auto; /* Automatically adjusts to the text length */
|
| 451 |
padding: 10px 20px; /* Adjust padding for a better look */
|
| 452 |
+
font-size: 12px; /* Control font size */
|
| 453 |
text-align: center; /* Center the text */
|
| 454 |
margin: 0 auto; /* Center the button horizontally */
|
| 455 |
display: inline-block; /* Prevent it from stretching */
|
renderer/humor.py
CHANGED
|
@@ -33,7 +33,7 @@ class HumorRenderer:
|
|
| 33 |
return fname
|
| 34 |
|
| 35 |
|
| 36 |
-
def render_overlaid(vertices, out_path, fps,colors=[],progress_bar=tqdm,**kwargs):
|
| 37 |
assert isinstance(vertices, list) and len(vertices) == 2
|
| 38 |
# Put the vertices at the floor level
|
| 39 |
# F X N x 3 ===> [F X N x 3, F X N x 3]
|
|
@@ -62,11 +62,10 @@ def render_overlaid(vertices, out_path, fps,colors=[],progress_bar=tqdm,**kwargs
|
|
| 62 |
viz_smpl_seq(
|
| 63 |
pyrender, out_folder, [body_pred0, body_pred1], fps=fps,progress_bar=progress_bar,vertex_color_list=colors, **kwargs
|
| 64 |
)
|
| 65 |
-
|
| 66 |
video = Video(out_folder, fps=fps)
|
| 67 |
video.save(out_path)
|
| 68 |
|
| 69 |
-
def render(vertices, out_path, fps,colors=[], progress_bar=tqdm
|
| 70 |
# Put the vertices at the floor level
|
| 71 |
ground = vertices[..., 2].min()
|
| 72 |
vertices[..., 2] -= ground
|
|
|
|
| 33 |
return fname
|
| 34 |
|
| 35 |
|
| 36 |
+
def render_overlaid(vertices, out_path, fps,colors=[], progress_bar=tqdm,**kwargs):
|
| 37 |
assert isinstance(vertices, list) and len(vertices) == 2
|
| 38 |
# Put the vertices at the floor level
|
| 39 |
# F X N x 3 ===> [F X N x 3, F X N x 3]
|
|
|
|
| 62 |
viz_smpl_seq(
|
| 63 |
pyrender, out_folder, [body_pred0, body_pred1], fps=fps,progress_bar=progress_bar,vertex_color_list=colors, **kwargs
|
| 64 |
)
|
|
|
|
| 65 |
video = Video(out_folder, fps=fps)
|
| 66 |
video.save(out_path)
|
| 67 |
|
| 68 |
+
def render(vertices, out_path, fps, colors=[], progress_bar=tqdm, **kwargs):
|
| 69 |
# Put the vertices at the floor level
|
| 70 |
ground = vertices[..., 2].min()
|
| 71 |
vertices[..., 2] -= ground
|