Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,7 @@ from huggingface_hub import hf_hub_download
|
|
31 |
import requests
|
32 |
import io
|
33 |
|
|
|
34 |
# Define video transformations
|
35 |
video_transforms = transforms.Compose(
|
36 |
[
|
@@ -76,6 +77,11 @@ pipe.set_adapters(["i2v"], adapter_weights=[1.0])
|
|
76 |
pipe.fuse_lora(components=["transformer"], lora_scale=1.0, adapter_names=["i2v"])
|
77 |
pipe.unload_lora_weights()
|
78 |
|
|
|
|
|
|
|
|
|
|
|
79 |
def resize_image_to_bucket(image: Union[Image.Image, np.ndarray], bucket_reso: Tuple[int, int]) -> np.ndarray:
|
80 |
"""
|
81 |
Resize the image to the bucket resolution.
|
@@ -323,11 +329,8 @@ def main():
|
|
323 |
with gr.Column(scale=3):
|
324 |
outputs = gr.Video(label="Generated Video")
|
325 |
with gr.Accordion(label="Examples"):
|
326 |
-
|
327 |
-
|
328 |
-
| Starting Frame | End Frame | Generated Video | | --- | --- | --- | | <img src="https://content.dashtoon.ai/stability-images/41aeca63-064a-4003-8c8b-bfe2cc80d275.png" width=200> | <img src="https://content.dashtoon.ai/stability-images/28956177-3455-4b56-bb6c-73eacef323ca.png" width=200> | <video controls autoplay src="https://content.dashtoon.ai/stability-images/14b7dd1a-1f46-4c4c-b4ec-9d0f948712af.mp4"></video> | | <img src="https://content.dashtoon.ai/stability-images/ddabbf2f-4218-497b-8239-b7b882d93000.png" width=200> | <img src="https://content.dashtoon.ai/stability-images/b603acba-40a4-44ba-aa26-ed79403df580.png" width=200> | <video controls autoplay src="https://content.dashtoon.ai/stability-images/b00ba193-b3b7-41a1-9bc1-9fdaceba6efa.mp4"></video> | | <img src="https://content.dashtoon.ai/stability-images/5298cf0c-0955-4568-935a-2fb66045f21d.png" width=200> | <img src="https://content.dashtoon.ai/stability-images/722a4ea7-7092-4323-8e83-3f627e8fd7f8.png" width=200> | <video controls autoplay src="https://content.dashtoon.ai/stability-images/0cb84780-4fdf-4ecc-ab48-12e7e1055a39.mp4"></video> | | <img src="https://content.dashtoon.ai/stability-images/69d9a49f-95c0-4e85-bd49-14a039373c8b.png" width=200> | <img src="https://content.dashtoon.ai/stability-images/0cef7fa9-e15a-48ec-9bd3-c61921181802.png" width=200> | <video controls autoplay src="https://content.dashtoon.ai/stability-images/ce12156f-0ac2-4d16-b489-37e85c61b5b2.mp4"></video> |
|
329 |
-
</div>
|
330 |
-
""", sanitize_html=False)
|
331 |
with gr.Accordion():
|
332 |
gr.Markdown("""
|
333 |
|
|
|
31 |
import requests
|
32 |
import io
|
33 |
|
34 |
+
|
35 |
# Define video transformations
|
36 |
video_transforms = transforms.Compose(
|
37 |
[
|
|
|
77 |
pipe.fuse_lora(components=["transformer"], lora_scale=1.0, adapter_names=["i2v"])
|
78 |
pipe.unload_lora_weights()
|
79 |
|
80 |
+
# Function to read the content of a markdown file in the same directory
|
81 |
+
def read_markdown_file(file_path):
|
82 |
+
with open(file_path, 'r', encoding='utf-8') as file:
|
83 |
+
return file.read()
|
84 |
+
|
85 |
def resize_image_to_bucket(image: Union[Image.Image, np.ndarray], bucket_reso: Tuple[int, int]) -> np.ndarray:
|
86 |
"""
|
87 |
Resize the image to the bucket resolution.
|
|
|
329 |
with gr.Column(scale=3):
|
330 |
outputs = gr.Video(label="Generated Video")
|
331 |
with gr.Accordion(label="Examples"):
|
332 |
+
markdown_content = read_markdown_file("examples.md")
|
333 |
+
gr.Markdown(markdown_content, sanitize_html=False)
|
|
|
|
|
|
|
334 |
with gr.Accordion():
|
335 |
gr.Markdown("""
|
336 |
|