Spaces:
Sleeping
Sleeping
Changes to be committed:
Browse files
app.py
CHANGED
|
@@ -28,22 +28,23 @@ def image_to_video(prompt, image, ltx_client):
|
|
| 28 |
return result
|
| 29 |
|
| 30 |
def personalized_video(prompt, image, request: gr.Request):
|
| 31 |
-
print(request.headers)
|
| 32 |
-
x_ip_token = request.headers['x-ip-token']
|
| 33 |
flux_client = Client("black-forest-labs/FLUX.1-Kontext-Dev", headers={"x-ip-token": x_ip_token})
|
| 34 |
ltx_client = Client("KingNish/ltx-video-distilled", headers={"x-ip-token": x_ip_token})
|
| 35 |
-
print(x_ip_token)
|
| 36 |
image = image_to_image(prompt, image, flux_client)
|
| 37 |
yield image, None
|
| 38 |
video = image_to_video(prompt, image, ltx_client)
|
| 39 |
yield image, video
|
| 40 |
|
| 41 |
with gr.Blocks() as demo:
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
submit_button.click(personalized_video, [prompt, input_image], [edited_image, output_video])
|
| 48 |
prompt.submit(personalized_video, [prompt, input_image], [edited_image, output_video])
|
| 49 |
|
|
@@ -54,8 +55,7 @@ with gr.Blocks() as demo:
|
|
| 54 |
# inputs=[prompt, input_image, flux_client, ltx_client],
|
| 55 |
# outputs=output_video,
|
| 56 |
# fn=personalized_video,
|
| 57 |
-
# cache_examples=
|
| 58 |
-
# cache_mode = "eager"
|
| 59 |
# )
|
| 60 |
|
| 61 |
demo.launch()
|
|
|
|
| 28 |
return result
|
| 29 |
|
| 30 |
def personalized_video(prompt, image, request: gr.Request):
|
|
|
|
|
|
|
| 31 |
flux_client = Client("black-forest-labs/FLUX.1-Kontext-Dev", headers={"x-ip-token": x_ip_token})
|
| 32 |
ltx_client = Client("KingNish/ltx-video-distilled", headers={"x-ip-token": x_ip_token})
|
|
|
|
| 33 |
image = image_to_image(prompt, image, flux_client)
|
| 34 |
yield image, None
|
| 35 |
video = image_to_video(prompt, image, ltx_client)
|
| 36 |
yield image, video
|
| 37 |
|
| 38 |
with gr.Blocks() as demo:
|
| 39 |
+
gr.Markdown("## Personalized Video Generator")
|
| 40 |
+
with gr.Row():
|
| 41 |
+
input_image = gr.Image(type="filepath")
|
| 42 |
+
prompt = gr.Textbox(max_lines=1)
|
| 43 |
+
submit_button = gr.Button("Submit")
|
| 44 |
+
with gr.Row():
|
| 45 |
+
gr.Markdown("## Output")
|
| 46 |
+
edited_image = gr.Image()
|
| 47 |
+
output_video = gr.Video()
|
| 48 |
submit_button.click(personalized_video, [prompt, input_image], [edited_image, output_video])
|
| 49 |
prompt.submit(personalized_video, [prompt, input_image], [edited_image, output_video])
|
| 50 |
|
|
|
|
| 55 |
# inputs=[prompt, input_image, flux_client, ltx_client],
|
| 56 |
# outputs=output_video,
|
| 57 |
# fn=personalized_video,
|
| 58 |
+
# cache_examples="lazy"
|
|
|
|
| 59 |
# )
|
| 60 |
|
| 61 |
demo.launch()
|