Spaces:
Running
Running
[AUTOMATED] Migration to Gradio 6.0
#15
by
multimodalart
HF Staff
- opened
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🍌
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.0.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
app.py
CHANGED
|
@@ -328,7 +328,7 @@ def _combine_videos_simple(video1_path: str, video2_path: str) -> str:
|
|
| 328 |
|
| 329 |
def _generate_video_segment(input_image_path: str, output_image_path: str, prompt: str, token: str) -> str:
|
| 330 |
"""Generates a single video segment using the external service."""
|
| 331 |
-
video_client = Client("multimodalart/wan-2-2-first-last-frame",
|
| 332 |
result = video_client.predict(
|
| 333 |
start_image_pil=handle_file(input_image_path),
|
| 334 |
end_image_pil=handle_file(output_image_path),
|
|
@@ -473,7 +473,7 @@ css = '''
|
|
| 473 |
#wan_ad p{text-align: center;padding: .5em}
|
| 474 |
'''
|
| 475 |
|
| 476 |
-
with gr.Blocks(
|
| 477 |
gr.HTML('''
|
| 478 |
<img class="logo-dark" src='https://huggingface.co/spaces/multimodalart/nano-banana/resolve/main/nano_banana_pros.png' style='margin: 0 auto; max-width: 650px' />
|
| 479 |
<img class="logo-light" src='https://huggingface.co/spaces/multimodalart/nano-banana/resolve/main/nano_banana_pros_light.png' style='margin: 0 auto; max-width: 650px' />
|
|
@@ -522,7 +522,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 522 |
create_video_button = gr.Button("Create video between the two images 🎥", variant="secondary", visible=False)
|
| 523 |
extend_video_button = gr.Button("Extend existing video with new scene 🎞️", variant="secondary", visible=False)
|
| 524 |
with gr.Group(visible=False) as video_group:
|
| 525 |
-
video_output = gr.Video(label="Generated Video",
|
| 526 |
gr.Markdown("Generate more with [Wan 2.2 first-last-frame](https://huggingface.co/spaces/multimodalart/wan-2-2-first-last-frame)", elem_id="wan_ad")
|
| 527 |
manual_token = gr.Textbox("Manual Token (to use with the API)", visible=False)
|
| 528 |
gr.Markdown("<h2 style='text-align: center'>Thank you for being a PRO! 🤗</h2>")
|
|
@@ -544,7 +544,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 544 |
fn=unified_image_generator,
|
| 545 |
inputs=[prompt_input, image_input_gallery, previous_video_state, last_frame_of_video_state, aspect_ratio_dropdown, model_radio, resolution_dropdown, manual_token],
|
| 546 |
outputs=[output_image, create_video_button, extend_video_button, video_group],
|
| 547 |
-
|
| 548 |
)
|
| 549 |
use_image_button.click(
|
| 550 |
fn=lambda img: (
|
|
@@ -553,25 +553,25 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 553 |
),
|
| 554 |
inputs=[output_image],
|
| 555 |
outputs=[image_input_gallery, output_image, create_video_button, extend_video_button, video_group],
|
| 556 |
-
|
| 557 |
)
|
| 558 |
create_video_button.click(
|
| 559 |
fn=lambda: gr.update(visible=True), outputs=[video_group],
|
| 560 |
-
|
| 561 |
).then(
|
| 562 |
fn=create_new_video,
|
| 563 |
inputs=[image_input_gallery, prompt_input, output_image],
|
| 564 |
outputs=[video_output, previous_video_state, last_frame_of_video_state],
|
| 565 |
-
|
| 566 |
)
|
| 567 |
extend_video_button.click(
|
| 568 |
fn=lambda: gr.update(visible=True), outputs=[video_group],
|
| 569 |
-
|
| 570 |
).then(
|
| 571 |
fn=extend_existing_video,
|
| 572 |
inputs=[image_input_gallery, prompt_input, output_image, previous_video_state],
|
| 573 |
outputs=[video_output, previous_video_state, last_frame_of_video_state],
|
| 574 |
-
|
| 575 |
)
|
| 576 |
|
| 577 |
def control_access(profile: Optional[gr.OAuthProfile] = None, oauth_token: Optional[gr.OAuthToken] = None):
|
|
@@ -589,4 +589,8 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=css) as demo:
|
|
| 589 |
demo.load(control_access, inputs=None, outputs=[main_interface, pro_message])
|
| 590 |
|
| 591 |
if __name__ == "__main__":
|
| 592 |
-
demo.queue(max_size=None, default_concurrency_limit=None).launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
|
| 329 |
def _generate_video_segment(input_image_path: str, output_image_path: str, prompt: str, token: str) -> str:
|
| 330 |
"""Generates a single video segment using the external service."""
|
| 331 |
+
video_client = Client("multimodalart/wan-2-2-first-last-frame", token=token)
|
| 332 |
result = video_client.predict(
|
| 333 |
start_image_pil=handle_file(input_image_path),
|
| 334 |
end_image_pil=handle_file(output_image_path),
|
|
|
|
| 473 |
#wan_ad p{text-align: center;padding: .5em}
|
| 474 |
'''
|
| 475 |
|
| 476 |
+
with gr.Blocks() as demo:
|
| 477 |
gr.HTML('''
|
| 478 |
<img class="logo-dark" src='https://huggingface.co/spaces/multimodalart/nano-banana/resolve/main/nano_banana_pros.png' style='margin: 0 auto; max-width: 650px' />
|
| 479 |
<img class="logo-light" src='https://huggingface.co/spaces/multimodalart/nano-banana/resolve/main/nano_banana_pros_light.png' style='margin: 0 auto; max-width: 650px' />
|
|
|
|
| 522 |
create_video_button = gr.Button("Create video between the two images 🎥", variant="secondary", visible=False)
|
| 523 |
extend_video_button = gr.Button("Extend existing video with new scene 🎞️", variant="secondary", visible=False)
|
| 524 |
with gr.Group(visible=False) as video_group:
|
| 525 |
+
video_output = gr.Video(label="Generated Video", buttons=["download"], autoplay=True)
|
| 526 |
gr.Markdown("Generate more with [Wan 2.2 first-last-frame](https://huggingface.co/spaces/multimodalart/wan-2-2-first-last-frame)", elem_id="wan_ad")
|
| 527 |
manual_token = gr.Textbox("Manual Token (to use with the API)", visible=False)
|
| 528 |
gr.Markdown("<h2 style='text-align: center'>Thank you for being a PRO! 🤗</h2>")
|
|
|
|
| 544 |
fn=unified_image_generator,
|
| 545 |
inputs=[prompt_input, image_input_gallery, previous_video_state, last_frame_of_video_state, aspect_ratio_dropdown, model_radio, resolution_dropdown, manual_token],
|
| 546 |
outputs=[output_image, create_video_button, extend_video_button, video_group],
|
| 547 |
+
api_visibility="private"
|
| 548 |
)
|
| 549 |
use_image_button.click(
|
| 550 |
fn=lambda img: (
|
|
|
|
| 553 |
),
|
| 554 |
inputs=[output_image],
|
| 555 |
outputs=[image_input_gallery, output_image, create_video_button, extend_video_button, video_group],
|
| 556 |
+
api_visibility="private"
|
| 557 |
)
|
| 558 |
create_video_button.click(
|
| 559 |
fn=lambda: gr.update(visible=True), outputs=[video_group],
|
| 560 |
+
api_visibility="private"
|
| 561 |
).then(
|
| 562 |
fn=create_new_video,
|
| 563 |
inputs=[image_input_gallery, prompt_input, output_image],
|
| 564 |
outputs=[video_output, previous_video_state, last_frame_of_video_state],
|
| 565 |
+
api_visibility="private"
|
| 566 |
)
|
| 567 |
extend_video_button.click(
|
| 568 |
fn=lambda: gr.update(visible=True), outputs=[video_group],
|
| 569 |
+
api_visibility="private"
|
| 570 |
).then(
|
| 571 |
fn=extend_existing_video,
|
| 572 |
inputs=[image_input_gallery, prompt_input, output_image, previous_video_state],
|
| 573 |
outputs=[video_output, previous_video_state, last_frame_of_video_state],
|
| 574 |
+
api_visibility="private"
|
| 575 |
)
|
| 576 |
|
| 577 |
def control_access(profile: Optional[gr.OAuthProfile] = None, oauth_token: Optional[gr.OAuthToken] = None):
|
|
|
|
| 589 |
demo.load(control_access, inputs=None, outputs=[main_interface, pro_message])
|
| 590 |
|
| 591 |
if __name__ == "__main__":
|
| 592 |
+
demo.queue(max_size=None, default_concurrency_limit=None).launch(
|
| 593 |
+
show_error=True,
|
| 594 |
+
theme=gr.themes.Citrus(),
|
| 595 |
+
css=css
|
| 596 |
+
)
|