Spaces:
Runtime error
Runtime error
Main commit
Browse files- Audios/alarm_clock.mp3 +0 -0
- Audios/classic_rock_mellow_gold_progressive.mp3 +0 -0
- Audios/guitar_riff.mp3 +0 -0
- Audios/reggae_fusion.mp3 +0 -0
- Audios/rock_and_roll.mp3 +0 -0
- Pictures/openjourney_1.png +0 -0
- README.md +29 -12
- main.py +153 -0
- requirements.txt +2 -0
Audios/alarm_clock.mp3
ADDED
Binary file (41.4 kB). View file
|
|
Audios/classic_rock_mellow_gold_progressive.mp3
ADDED
Binary file (41.4 kB). View file
|
|
Audios/guitar_riff.mp3
ADDED
Binary file (41.4 kB). View file
|
|
Audios/reggae_fusion.mp3
ADDED
Binary file (41.4 kB). View file
|
|
Audios/rock_and_roll.mp3
ADDED
Binary file (41.4 kB). View file
|
|
Pictures/openjourney_1.png
ADDED
README.md
CHANGED
@@ -1,12 +1,29 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stable Riffusion Walk
|
2 |
+
|
3 |
+
Streamlit Webapp for Stable Riffusion Walk using [Sieve](https://www.sievedata.com)
|
4 |
+
|
5 |
+
|
6 |
+
This webapp combines [Stable Riffusion](https://www.riffusion.com) and [Stable Diffusion Walk](https://github.com/nateraw/stable-diffusion-videos) via Sieve's Workflows. The interface is built using Streamlit.
|
7 |
+
|
8 |
+
Some example generations:
|
9 |
+
|
10 |
+
|
11 |
+
![](Videos/skull_demon.mp4)
|
12 |
+
Audio prompt: Hans Zimmer
|
13 |
+
|
14 |
+
Video prompt: Skull demon sorcerer Concept art portrait by Terese Nielsen, Brom, Miho Hirano, hyperdetailed intricately detailed gothic art trending on Artstation triadic colors Unreal Engine 5 detailed matte painting, Dark Black Velvet Background, art nouveau, deep color, fantastical, intricate detail, splash screen, complementary colors, fantasy concept art, gothic deviantart masterpiece, Vivid colors, 16k, UHD, HDR10, (Masterpiece:1. 5), Absurdres, (best quality:1. 5) Model: ReV Animated v1. 21
|
15 |
+
|
16 |
+
<br>
|
17 |
+
|
18 |
+
![](Videos/floating_island_waterfall.mp4)
|
19 |
+
Audio prompt: Relaxing, Floating, Waterfall
|
20 |
+
|
21 |
+
Video prompt: floating island in the clouds, nice weather, trees, a wooden house, waterfall
|
22 |
+
|
23 |
+
<br>
|
24 |
+
|
25 |
+
![](Videos/pixel_fighting_game_new_orleans_blues.mp4)
|
26 |
+
|
27 |
+
Audio prompt: New Orleans Blues
|
28 |
+
|
29 |
+
Video prompt: pixel video game with fighting dragons, high quality
|
main.py
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import requests
|
3 |
+
import time
|
4 |
+
|
5 |
+
API_KEY = str(st.secrets['SIEVE_API_KEY'])
|
6 |
+
|
7 |
+
st.title("Stable Riffusion Walk")
|
8 |
+
st.markdown('Built by [Gaurang Bharti](https://twitter.com/gaurang_bharti) Powered by [Sieve](https://www.sievedata.com)')
|
9 |
+
st.markdown("Stable Riffusion Walk combines [Stable Diffusion Walk](https://github.com/nateraw/stable-diffusion-videos) and [Stable Riffusion](https://www.riffusion.com) to generate music videos through Stable Diffusion!")
|
10 |
+
st.caption("Generations can take anywhere from 3-5 mins to 10+ mins depending on demand. Please be patient :)")
|
11 |
+
|
12 |
+
def check_status(url, interval, job_id):
|
13 |
+
finished = False
|
14 |
+
headers = {
|
15 |
+
'X-API-Key': API_KEY
|
16 |
+
}
|
17 |
+
while True:
|
18 |
+
response = requests.get(url, headers=headers)
|
19 |
+
assert response.json()['data'], print(response.json())
|
20 |
+
data = response.json()['data']
|
21 |
+
|
22 |
+
for job in data:
|
23 |
+
if job['id'] == job_id:
|
24 |
+
|
25 |
+
if job['status'] == 'processing':
|
26 |
+
|
27 |
+
time.sleep(interval)
|
28 |
+
if job['status'] == 'finished':
|
29 |
+
|
30 |
+
finished = True
|
31 |
+
return finished
|
32 |
+
if job['status'] == 'error':
|
33 |
+
st.error("An error occured, please try again. If the error persists, please inform the developers.")
|
34 |
+
print(job['error'])
|
35 |
+
return job['error']
|
36 |
+
|
37 |
+
def fetch_video(job_id):
|
38 |
+
url = f"https://mango.sievedata.com/v1/jobs/{job_id}"
|
39 |
+
headers = {
|
40 |
+
'Content-Type': 'application/json',
|
41 |
+
'X-API-Key': API_KEY
|
42 |
+
}
|
43 |
+
response = requests.get(url, headers = headers)
|
44 |
+
data = response.json()
|
45 |
+
url = data['data'][0]['url']
|
46 |
+
return url
|
47 |
+
|
48 |
+
def send_data(audio_text, video_text, duration, name):
|
49 |
+
url = "https://mango.sievedata.com/v1/push"
|
50 |
+
|
51 |
+
headers = {
|
52 |
+
'Content-Type': 'application/json',
|
53 |
+
'X-API-Key': API_KEY
|
54 |
+
}
|
55 |
+
data = {
|
56 |
+
"workflow_name": name,
|
57 |
+
"inputs": {
|
58 |
+
"video_prompt": video_text,
|
59 |
+
"audio_prompt": audio_text,
|
60 |
+
"duration": duration
|
61 |
+
}
|
62 |
+
}
|
63 |
+
try:
|
64 |
+
response = requests.post(url, headers=headers, json=data)
|
65 |
+
if ('id') not in response.json():
|
66 |
+
st.error(response.json()['description'])
|
67 |
+
return False
|
68 |
+
return (response.json()['id'])
|
69 |
+
except Exception as e:
|
70 |
+
return (f'An error occurred: {e}')
|
71 |
+
|
72 |
+
#Streamlit App
|
73 |
+
st.subheader("Music")
|
74 |
+
audio_in = st.text_input('Try your favorite styles, instruments like saxophone or violin, modifiers like arabic or jamaican, genres like jazz or gospel, sounds like church bells or rain, or any combination', placeholder="Enter prompt for music here", max_chars=100)
|
75 |
+
|
76 |
+
with st.expander("Music examples"):
|
77 |
+
st.write("Alarm Clock")
|
78 |
+
st.audio("Audios/alarm_clock.mp3")
|
79 |
+
st.write("Class Rock Mellow Gold Progressive")
|
80 |
+
st.audio("Audios/classic_rock_mellow_gold_progressive.mp3")
|
81 |
+
st.write("Guitar Riff")
|
82 |
+
st.audio("Audios/guitar_riff.mp3")
|
83 |
+
st.write("Reggae Fusion")
|
84 |
+
st.audio("Audios/reggae_fusion.mp3")
|
85 |
+
st.write("Rock & Roll")
|
86 |
+
st.audio("Audios/rock_and_roll.mp3")
|
87 |
+
|
88 |
+
music_options = ["None", "Alarm Clock", "Classic Rock Mellow Gold Progressive", "Guitar Riff", "Reggae Fusion", "Rock & Roll"]
|
89 |
+
music_example = st.radio("Or try something from the examples! (Set to None if you're using a custom prompt)", options=music_options)
|
90 |
+
|
91 |
+
if music_example != "None":
|
92 |
+
audio_in = music_example
|
93 |
+
|
94 |
+
st.subheader("Video")
|
95 |
+
|
96 |
+
video_in = st.text_input("Describe the visuals of the video! You can try any Stable Diffusion or Midjourney prompts. Some examples below!", placeholder="Enter prompt for video here")
|
97 |
+
|
98 |
+
st.caption("Note: More complex prompts will take longer")
|
99 |
+
with st.expander("Music Video examples"):
|
100 |
+
col1, col2 = st.columns([1, 1])
|
101 |
+
with col1:
|
102 |
+
st.write("Audio prompt: Hans Zimmer")
|
103 |
+
st.write("Video prompt: Skull demon sorcerer Concept art portrait by Terese Nielsen, Brom, Miho Hirano, hyperdetailed intricately detailed gothic art trending on Artstation triadic colors Unreal Engine 5 detailed matte painting, Dark Black Velvet Background, art nouveau, deep color, fantastical, intricate detail, splash screen, complementary colors, fantasy concept art, gothic deviantart masterpiece, Vivid colors, 16k, UHD, HDR10, (Masterpiece:1. 5), Absurdres, (best quality:1. 5) Model: ReV Animated v1. 21")
|
104 |
+
with col2:
|
105 |
+
st.video("Videos/skull_demon.mp4")
|
106 |
+
col3, col4 = st.columns([1, 1])
|
107 |
+
with col3:
|
108 |
+
st.write("Audio prompt: Relaxing, Floating, Waterfall")
|
109 |
+
st.write("Video prompt: floating island in the clouds, nice weather, trees, a wooden house, waterfall")
|
110 |
+
with col4:
|
111 |
+
st.video("Videos/floating_island_waterfall.mp4")
|
112 |
+
col5, col6 = st.columns([1, 1])
|
113 |
+
with col5:
|
114 |
+
st.write("Audio prompt: New Orleans Blues")
|
115 |
+
st.write("Video prompt: pixel video game with fighting dragons, high quality")
|
116 |
+
with col6:
|
117 |
+
st.video("Videos/pixel_fighting_game_new_orleans_blues.mp4")
|
118 |
+
|
119 |
+
input_duration = st.slider("Duration (seconds)", 4, 7, 5)
|
120 |
+
|
121 |
+
workflow_name = "openjourney-test"
|
122 |
+
|
123 |
+
# Experimental
|
124 |
+
|
125 |
+
#workflow_names = ["stable-riffusion-walk", "openjourney-test"]
|
126 |
+
|
127 |
+
# st.write("Pick one of these models for the video")
|
128 |
+
# options = ["OpenJourney", "Stable Diffusion v1.5"]
|
129 |
+
# col1, col2 = st.columns([1, 1])
|
130 |
+
# with col1:
|
131 |
+
# selected_option = st.radio("Select an option", options)
|
132 |
+
# with col2:
|
133 |
+
# if selected_option == "Stable Diffusion v1.5":
|
134 |
+
# st.image("sd_21_2.jpg", width=300)
|
135 |
+
# workflow_name = "stable-riffusion-walk"
|
136 |
+
# elif selected_option == "Openjourney":
|
137 |
+
# st.image("openjourney_1.png", width=300)
|
138 |
+
# workflow_name = "openjourney-test"
|
139 |
+
|
140 |
+
button1 = st.button("Diffuse!")
|
141 |
+
|
142 |
+
if st.session_state.get('button') != True:
|
143 |
+
st.session_state['button'] = button1
|
144 |
+
|
145 |
+
if st.session_state['button'] == True:
|
146 |
+
|
147 |
+
job = send_data(audio_in, video_in, input_duration, workflow_name)
|
148 |
+
if job:
|
149 |
+
with st.spinner("Processing Video"):
|
150 |
+
status = check_status('https://mango.sievedata.com/v1/jobs', 5, str(job))
|
151 |
+
if status == True:
|
152 |
+
video = fetch_video(job)
|
153 |
+
st.video(video)
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
requests
|
2 |
+
wget
|