Spaces:
Runtime error
Runtime error
Commit
·
08164b1
1
Parent(s):
50065d8
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import replicate
|
3 |
+
|
4 |
+
# Set the replicate API token
|
5 |
+
import os
|
6 |
+
os.environ["REPLICATE_API_TOKEN"] = "r8_JSR8xlRoCk6cmq3qEOOThVTn3dAgdPq1bWXdj"
|
7 |
+
|
8 |
+
def run_replicate_model(input_params):
|
9 |
+
output = replicate.run(
|
10 |
+
"stability-ai/stable-video-diffusion:3f0457e4619daac51203dedb472816fd4af51f3149fa7a9e0b5ffcf1b8172438",
|
11 |
+
input=input_params
|
12 |
+
)
|
13 |
+
return output
|
14 |
+
|
15 |
+
st.title("Stable Video Diffusion")
|
16 |
+
st.write("Fill in the input parameters and click on the button to run the Stable Video Diffusion model.")
|
17 |
+
|
18 |
+
cond_aug = st.number_input("Conditioning Augmentation", value=0.02)
|
19 |
+
decoding_t = st.number_input("Decoding Time", value=7)
|
20 |
+
input_image = st.text_input("Input Image URL", "https://example.com/s-widua-icjKmXvsO7U-unsplash.jpg")
|
21 |
+
video_length = st.selectbox("Video Length", ["14_frames_with_svd", "other_options"])
|
22 |
+
sizing_strategy = st.selectbox("Sizing Strategy", ["maintain_aspect_ratio", "other_options"])
|
23 |
+
motion_bucket_id = st.number_input("Motion Bucket ID", value=127)
|
24 |
+
frames_per_second = st.number_input("Frames Per Second", value=6)
|
25 |
+
|
26 |
+
input_params = {
|
27 |
+
"cond_aug": cond_aug,
|
28 |
+
"decoding_t": decoding_t,
|
29 |
+
"input_image": input_image,
|
30 |
+
"video_length": video_length,
|
31 |
+
"sizing_strategy": sizing_strategy,
|
32 |
+
"motion_bucket_id": motion_bucket_id,
|
33 |
+
"frames_per_second": frames_per_second
|
34 |
+
}
|
35 |
+
|
36 |
+
if st.button("Run Model"):
|
37 |
+
output_result = run_replicate_model(input_params)
|
38 |
+
st.write("Output:")
|
39 |
+
st.code(output_result, language="json")
|