Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
eabc43b
1
Parent(s):
10f9823
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
from model import Jamify
|
4 |
-
|
5 |
# Initialize the Jamify model once
|
6 |
print("Initializing Jamify model...")
|
7 |
jamify_model = Jamify()
|
8 |
print("Jamify model ready.")
|
9 |
|
|
|
|
|
10 |
def generate_song(reference_audio, lyrics_file, style_prompt, duration):
|
11 |
# We need to save the uploaded files to temporary paths to pass to the model
|
12 |
-
|
13 |
-
|
14 |
|
15 |
# The model expects paths, so we write the prompt to a temp file if needed
|
16 |
# (This part of the model could be improved to accept the string directly)
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
from model import Jamify
|
4 |
+
import spaces
|
5 |
# Initialize the Jamify model once
|
6 |
print("Initializing Jamify model...")
|
7 |
jamify_model = Jamify()
|
8 |
print("Jamify model ready.")
|
9 |
|
10 |
+
|
11 |
+
@spaces.GPU(duration=100)
|
12 |
def generate_song(reference_audio, lyrics_file, style_prompt, duration):
|
13 |
# We need to save the uploaded files to temporary paths to pass to the model
|
14 |
+
reference_audio = reference_audio if reference_audio else None
|
15 |
+
|
16 |
|
17 |
# The model expects paths, so we write the prompt to a temp file if needed
|
18 |
# (This part of the model could be improved to accept the string directly)
|