Spaces:
Running
Running
Changes to be committed:
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ def image_to_image(prompt, image, dimension, flux_client):
|
|
| 55 |
input_image=handle_file(padded_image_path),
|
| 56 |
prompt=prompt,
|
| 57 |
guidance_scale=2.5,
|
| 58 |
-
|
| 59 |
randomize_seed=True,
|
| 60 |
api_name="/infer"
|
| 61 |
)
|
|
@@ -68,7 +68,7 @@ def image_to_image(prompt, image, dimension, flux_client):
|
|
| 68 |
pass
|
| 69 |
return image[0]
|
| 70 |
|
| 71 |
-
def image_to_video(prompt, image, ltx_client):
|
| 72 |
result = ltx_client.predict(
|
| 73 |
prompt=prompt,
|
| 74 |
input_image_url=None,
|
|
@@ -80,13 +80,13 @@ def image_to_video(prompt, image, ltx_client):
|
|
| 80 |
print(result)
|
| 81 |
return result
|
| 82 |
|
| 83 |
-
def personalized_video(prompt, image, dimension, request: gr.Request):
|
| 84 |
x_ip_token = request.headers['x-ip-token']
|
| 85 |
flux_client = Client("black-forest-labs/FLUX.1-Kontext-Dev", headers={"x-ip-token": x_ip_token})
|
| 86 |
ltx_client = Client("KingNish/ltx-video-distilled", headers={"x-ip-token": x_ip_token})
|
| 87 |
image = image_to_image(prompt, image, dimension, flux_client)
|
| 88 |
yield image, None
|
| 89 |
-
video = image_to_video(prompt, image, ltx_client)
|
| 90 |
yield image, video
|
| 91 |
|
| 92 |
with gr.Blocks() as demo:
|
|
@@ -96,6 +96,7 @@ with gr.Blocks() as demo:
|
|
| 96 |
input_image = gr.Image(label="Input Image", type="filepath")
|
| 97 |
prompt = gr.Textbox(label="Prompt")
|
| 98 |
dimension = gr.Radio(["Square (1024x1024)", "Portrait (768x1360)", "Landscape (1360x768)"], label="Dimension", value="Square (1024x1024)")
|
|
|
|
| 99 |
submit_button = gr.Button("Submit")
|
| 100 |
with gr.Column():
|
| 101 |
edited_image = gr.Image(label="Edited Image")
|
|
|
|
| 55 |
input_image=handle_file(padded_image_path),
|
| 56 |
prompt=prompt,
|
| 57 |
guidance_scale=2.5,
|
| 58 |
+
steps=25,
|
| 59 |
randomize_seed=True,
|
| 60 |
api_name="/infer"
|
| 61 |
)
|
|
|
|
| 68 |
pass
|
| 69 |
return image[0]
|
| 70 |
|
| 71 |
+
def image_to_video(prompt, image, duration, ltx_client):
|
| 72 |
result = ltx_client.predict(
|
| 73 |
prompt=prompt,
|
| 74 |
input_image_url=None,
|
|
|
|
| 80 |
print(result)
|
| 81 |
return result
|
| 82 |
|
| 83 |
+
def personalized_video(prompt, image, dimension, duration, request: gr.Request):
|
| 84 |
x_ip_token = request.headers['x-ip-token']
|
| 85 |
flux_client = Client("black-forest-labs/FLUX.1-Kontext-Dev", headers={"x-ip-token": x_ip_token})
|
| 86 |
ltx_client = Client("KingNish/ltx-video-distilled", headers={"x-ip-token": x_ip_token})
|
| 87 |
image = image_to_image(prompt, image, dimension, flux_client)
|
| 88 |
yield image, None
|
| 89 |
+
video = image_to_video(prompt, image, duration, ltx_client)
|
| 90 |
yield image, video
|
| 91 |
|
| 92 |
with gr.Blocks() as demo:
|
|
|
|
| 96 |
input_image = gr.Image(label="Input Image", type="filepath")
|
| 97 |
prompt = gr.Textbox(label="Prompt")
|
| 98 |
dimension = gr.Radio(["Square (1024x1024)", "Portrait (768x1360)", "Landscape (1360x768)"], label="Dimension", value="Square (1024x1024)")
|
| 99 |
+
duration = gr.Slider(minimum=1, maximum=5, value=4, label="Video Duration")
|
| 100 |
submit_button = gr.Button("Submit")
|
| 101 |
with gr.Column():
|
| 102 |
edited_image = gr.Image(label="Edited Image")
|