Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,10 +15,7 @@ from diffsynth import ModelManager
|
|
| 15 |
from diffusers.utils import load_image, export_to_video
|
| 16 |
|
| 17 |
import uuid
|
| 18 |
-
from huggingface_hub import hf_hub_download
|
| 19 |
|
| 20 |
-
|
| 21 |
-
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
|
| 22 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 23 |
# Constants
|
| 24 |
MAX_SEED = np.iinfo(np.int32).max
|
|
@@ -46,7 +43,6 @@ if torch.cuda.is_available():
|
|
| 46 |
pipe = SVDVideoPipeline.from_model_manager(model_manager)
|
| 47 |
|
| 48 |
|
| 49 |
-
# function source codes modified from multimodalart/stable-video-diffusion
|
| 50 |
@spaces.GPU(duration=120)
|
| 51 |
def generate(
|
| 52 |
image,
|
|
@@ -126,8 +122,8 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
| 126 |
)
|
| 127 |
with gr.Row():
|
| 128 |
submit_btn = gr.Button(value="Generate")
|
| 129 |
-
clear_btn = gr.ClearButton([image, seed, video])
|
| 130 |
stop_btn = gr.Button(variant="stop")
|
|
|
|
| 131 |
gr.Examples(
|
| 132 |
examples=examples,
|
| 133 |
inputs=image,
|
|
@@ -138,6 +134,6 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
| 138 |
)
|
| 139 |
|
| 140 |
submit_event = submit_btn.click(fn=generate, inputs=[image, seed, motion_bucket_id, fps_id], outputs=[video, seed], api_name="video")
|
| 141 |
-
stop_btn.click(
|
| 142 |
|
| 143 |
demo.queue().launch()
|
|
|
|
| 15 |
from diffusers.utils import load_image, export_to_video
|
| 16 |
|
| 17 |
import uuid
|
|
|
|
| 18 |
|
|
|
|
|
|
|
| 19 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 20 |
# Constants
|
| 21 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 43 |
pipe = SVDVideoPipeline.from_model_manager(model_manager)
|
| 44 |
|
| 45 |
|
|
|
|
| 46 |
@spaces.GPU(duration=120)
|
| 47 |
def generate(
|
| 48 |
image,
|
|
|
|
| 122 |
)
|
| 123 |
with gr.Row():
|
| 124 |
submit_btn = gr.Button(value="Generate")
|
|
|
|
| 125 |
stop_btn = gr.Button(variant="stop")
|
| 126 |
+
clear_btn = gr.ClearButton([image, seed, video])
|
| 127 |
gr.Examples(
|
| 128 |
examples=examples,
|
| 129 |
inputs=image,
|
|
|
|
| 134 |
)
|
| 135 |
|
| 136 |
submit_event = submit_btn.click(fn=generate, inputs=[image, seed, motion_bucket_id, fps_id], outputs=[video, seed], api_name="video")
|
| 137 |
+
stop_btn.click(lambda _: gr.update(interactive=False), None, stop_btn, cancels=[submit_event])
|
| 138 |
|
| 139 |
demo.queue().launch()
|