Spaces:
Sleeping
Sleeping
add gr.Info bubbles for each api calls
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from gradio_client import Client, handle_file
|
|
| 3 |
|
| 4 |
# Step 1: Generate first image
|
| 5 |
def call_image_gen(prompt, oauth_token: gr.OAuthToken):
|
|
|
|
| 6 |
client = Client("multimodalart/Qwen-Image-Fast", hf_token=oauth_token.token)
|
| 7 |
result = client.predict(
|
| 8 |
prompt=prompt,
|
|
@@ -19,6 +20,7 @@ def call_image_gen(prompt, oauth_token: gr.OAuthToken):
|
|
| 19 |
|
| 20 |
# Step 2: Edit image
|
| 21 |
def call_edit(input_image, prompt, oauth_token: gr.OAuthToken):
|
|
|
|
| 22 |
client = Client("multimodalart/Qwen-Image-Edit-Fast", hf_token=oauth_token.token)
|
| 23 |
result = client.predict(
|
| 24 |
image=handle_file(input_image),
|
|
@@ -35,6 +37,7 @@ def call_edit(input_image, prompt, oauth_token: gr.OAuthToken):
|
|
| 35 |
|
| 36 |
# Step 3: Generate video from First/Last frames
|
| 37 |
def call_video_gen(start_image_in, end_image_in, action_prompt, oauth_token: gr.OAuthToken):
|
|
|
|
| 38 |
client = Client("multimodalart/wan-2-2-first-last-frame", hf_token=oauth_token.token)
|
| 39 |
result = client.predict(
|
| 40 |
start_image_pil=handle_file(start_image_in),
|
|
@@ -87,6 +90,7 @@ with gr.Blocks() as demo:
|
|
| 87 |
fn = call_image_gen,
|
| 88 |
inputs = [first_gen_prompt],
|
| 89 |
outputs = [first_image],
|
|
|
|
| 90 |
queue=False
|
| 91 |
)
|
| 92 |
|
|
@@ -94,6 +98,7 @@ with gr.Blocks() as demo:
|
|
| 94 |
fn = call_edit,
|
| 95 |
inputs = [first_image, edit_gen_prompt],
|
| 96 |
outputs = [last_image],
|
|
|
|
| 97 |
queue=False
|
| 98 |
)
|
| 99 |
|
|
@@ -101,6 +106,7 @@ with gr.Blocks() as demo:
|
|
| 101 |
fn = call_video_gen,
|
| 102 |
inputs = [first_image, last_image, video_gen_prompt],
|
| 103 |
outputs = [video_result],
|
|
|
|
| 104 |
queue=False
|
| 105 |
)
|
| 106 |
|
|
|
|
| 3 |
|
| 4 |
# Step 1: Generate first image
|
| 5 |
def call_image_gen(prompt, oauth_token: gr.OAuthToken):
|
| 6 |
+
gr.Info("Calling multimodalart/Qwen-Image-Fast...")
|
| 7 |
client = Client("multimodalart/Qwen-Image-Fast", hf_token=oauth_token.token)
|
| 8 |
result = client.predict(
|
| 9 |
prompt=prompt,
|
|
|
|
| 20 |
|
| 21 |
# Step 2: Edit image
|
| 22 |
def call_edit(input_image, prompt, oauth_token: gr.OAuthToken):
|
| 23 |
+
gr.Info("Calling multimodalart/Qwen-Image-Edit-Fast...")
|
| 24 |
client = Client("multimodalart/Qwen-Image-Edit-Fast", hf_token=oauth_token.token)
|
| 25 |
result = client.predict(
|
| 26 |
image=handle_file(input_image),
|
|
|
|
| 37 |
|
| 38 |
# Step 3: Generate video from First/Last frames
|
| 39 |
def call_video_gen(start_image_in, end_image_in, action_prompt, oauth_token: gr.OAuthToken):
|
| 40 |
+
gr.Info("Calling multimodalart/wan-2-2-first-last-frame...")
|
| 41 |
client = Client("multimodalart/wan-2-2-first-last-frame", hf_token=oauth_token.token)
|
| 42 |
result = client.predict(
|
| 43 |
start_image_pil=handle_file(start_image_in),
|
|
|
|
| 90 |
fn = call_image_gen,
|
| 91 |
inputs = [first_gen_prompt],
|
| 92 |
outputs = [first_image],
|
| 93 |
+
show_api=False,
|
| 94 |
queue=False
|
| 95 |
)
|
| 96 |
|
|
|
|
| 98 |
fn = call_edit,
|
| 99 |
inputs = [first_image, edit_gen_prompt],
|
| 100 |
outputs = [last_image],
|
| 101 |
+
show_api=False,
|
| 102 |
queue=False
|
| 103 |
)
|
| 104 |
|
|
|
|
| 106 |
fn = call_video_gen,
|
| 107 |
inputs = [first_image, last_image, video_gen_prompt],
|
| 108 |
outputs = [video_result],
|
| 109 |
+
show_api=False,
|
| 110 |
queue=False
|
| 111 |
)
|
| 112 |
|