spookyuser
commited on
Commit
·
cbc2b5b
1
Parent(s):
fb39589
Get image first
Browse files
app.py
CHANGED
|
@@ -20,14 +20,14 @@ class SpotifyApi:
|
|
| 20 |
final_directory = output_dir
|
| 21 |
|
| 22 |
def __init__(self):
|
| 23 |
-
self.
|
| 24 |
|
| 25 |
-
def
|
| 26 |
# Check if the credentials file exists
|
| 27 |
-
if not os.path.exists("
|
| 28 |
with open("spotify.rc", "w") as f:
|
| 29 |
f.write(
|
| 30 |
-
f"
|
| 31 |
)
|
| 32 |
subprocess.call(["spodcast", "-l", "spotify.rc"])
|
| 33 |
else:
|
|
@@ -63,10 +63,10 @@ class SpotifyApi:
|
|
| 63 |
|
| 64 |
|
| 65 |
def process_inputs(prompt, audio, spotify_url) -> str:
|
| 66 |
-
image = get_stable_diffusion_image(prompt)
|
| 67 |
if spotify_url:
|
| 68 |
spotify = SpotifyApi()
|
| 69 |
audio = spotify.download_episode(spotify_url)
|
|
|
|
| 70 |
video = add_static_image_to_audio(image, audio)
|
| 71 |
return video
|
| 72 |
|
|
|
|
| 20 |
final_directory = output_dir
|
| 21 |
|
| 22 |
def __init__(self):
|
| 23 |
+
self.setup_spotify
|
| 24 |
|
| 25 |
+
def setup_spotify(self) -> None:
|
| 26 |
# Check if the credentials file exists
|
| 27 |
+
if not os.path.exists("spotify.rc"):
|
| 28 |
with open("spotify.rc", "w") as f:
|
| 29 |
f.write(
|
| 30 |
+
f"1 3"
|
| 31 |
)
|
| 32 |
subprocess.call(["spodcast", "-l", "spotify.rc"])
|
| 33 |
else:
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
def process_inputs(prompt, audio, spotify_url) -> str:
|
|
|
|
| 66 |
if spotify_url:
|
| 67 |
spotify = SpotifyApi()
|
| 68 |
audio = spotify.download_episode(spotify_url)
|
| 69 |
+
image = get_stable_diffusion_image(prompt)
|
| 70 |
video = add_static_image_to_audio(image, audio)
|
| 71 |
return video
|
| 72 |
|