Spaces:
Running
on
Zero
Running
on
Zero
chong.zhang
commited on
Commit
·
9364cd5
1
Parent(s):
8611ab8
update
Browse files
app.py
CHANGED
@@ -20,12 +20,9 @@ import torchaudio
|
|
20 |
import datetime
|
21 |
import hashlib
|
22 |
import torch
|
23 |
-
import subprocess
|
24 |
import importlib
|
25 |
import sys
|
26 |
|
27 |
-
|
28 |
-
|
29 |
os.system('nvidia-smi')
|
30 |
os.system('apt update -y && apt-get install -y apt-utils && apt install -y unzip')
|
31 |
os.system('pip install flash-attn --no-build-isolation')
|
@@ -92,7 +89,7 @@ def trim_audio(audio_file, cut_seconds=5):
|
|
92 |
torchaudio.save(output_path, cutted_audio, sr)
|
93 |
return output_path
|
94 |
|
95 |
-
|
96 |
def music_generation(args):
|
97 |
set_env_variables()
|
98 |
model = InspireMusicUnified(
|
@@ -123,7 +120,7 @@ def music_generation(args):
|
|
123 |
return output_path
|
124 |
|
125 |
|
126 |
-
|
127 |
def demo_inspiremusic_t2m(text, model_name, chorus,
|
128 |
output_sample_rate, max_generate_audio_seconds):
|
129 |
args = get_args(
|
@@ -133,7 +130,7 @@ def demo_inspiremusic_t2m(text, model_name, chorus,
|
|
133 |
max_generate_audio_seconds=max_generate_audio_seconds)
|
134 |
return music_generation(args)
|
135 |
|
136 |
-
|
137 |
def demo_inspiremusic_con(text, audio, model_name, chorus,
|
138 |
output_sample_rate, max_generate_audio_seconds):
|
139 |
args = get_args(
|
@@ -143,7 +140,7 @@ def demo_inspiremusic_con(text, audio, model_name, chorus,
|
|
143 |
max_generate_audio_seconds=max_generate_audio_seconds)
|
144 |
return music_generation(args)
|
145 |
|
146 |
-
|
147 |
def main():
|
148 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
149 |
gr.Markdown("""
|
@@ -192,5 +189,4 @@ def main():
|
|
192 |
|
193 |
if __name__ == '__main__':
|
194 |
# subprocess.run(['bash', 'install.sh'], shell=True)
|
195 |
-
@spaces.GPU
|
196 |
main()
|
|
|
20 |
import datetime
|
21 |
import hashlib
|
22 |
import torch
|
|
|
23 |
import importlib
|
24 |
import sys
|
25 |
|
|
|
|
|
26 |
os.system('nvidia-smi')
|
27 |
os.system('apt update -y && apt-get install -y apt-utils && apt install -y unzip')
|
28 |
os.system('pip install flash-attn --no-build-isolation')
|
|
|
89 |
torchaudio.save(output_path, cutted_audio, sr)
|
90 |
return output_path
|
91 |
|
92 |
+
@spaces.GPU(duration=600)
|
93 |
def music_generation(args):
|
94 |
set_env_variables()
|
95 |
model = InspireMusicUnified(
|
|
|
120 |
return output_path
|
121 |
|
122 |
|
123 |
+
@spaces.GPU
|
124 |
def demo_inspiremusic_t2m(text, model_name, chorus,
|
125 |
output_sample_rate, max_generate_audio_seconds):
|
126 |
args = get_args(
|
|
|
130 |
max_generate_audio_seconds=max_generate_audio_seconds)
|
131 |
return music_generation(args)
|
132 |
|
133 |
+
@spaces.GPU
|
134 |
def demo_inspiremusic_con(text, audio, model_name, chorus,
|
135 |
output_sample_rate, max_generate_audio_seconds):
|
136 |
args = get_args(
|
|
|
140 |
max_generate_audio_seconds=max_generate_audio_seconds)
|
141 |
return music_generation(args)
|
142 |
|
143 |
+
@spaces.GPU(duration=6000)
|
144 |
def main():
|
145 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
146 |
gr.Markdown("""
|
|
|
189 |
|
190 |
if __name__ == '__main__':
|
191 |
# subprocess.run(['bash', 'install.sh'], shell=True)
|
|
|
192 |
main()
|