Spaces:
Running
on
Zero
Running
on
Zero
keshavbhandari
commited on
Commit
•
ab57d7f
1
Parent(s):
31f1869
checking fluidsynth install
Browse files- app.py +8 -9
- post_install.py +13 -0
- setup.txt +18 -1
app.py
CHANGED
@@ -25,8 +25,7 @@ Generate midi music using Text2midi by providing a text prompt.
|
|
25 |
# Gradio input and output components
|
26 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
27 |
output_audio = gr.Audio(label="Generated Music", type="filepath")
|
28 |
-
|
29 |
-
guidance_scale = gr.Slider(minimum=1, maximum=10, value=3, step=0.1, label="Guidance Scale", interactive=True)
|
30 |
|
31 |
# CSS styling for the Duplicate button
|
32 |
css = '''
|
@@ -41,17 +40,17 @@ css = '''
|
|
41 |
# Gradio interface
|
42 |
gr_interface = gr.Interface(
|
43 |
fn=gradio_generate,
|
44 |
-
inputs=[input_text,
|
45 |
outputs=[output_audio],
|
46 |
description=description_text,
|
47 |
allow_flagging=False,
|
48 |
examples=[
|
49 |
-
["This techno song features a synth lead playing the main melody. This is accompanied by programmed percussion playing a simple kick focused beat. The hi-hat is accented in an open position on the 3-and count of every bar. The synth plays the bass part with a voicing that sounds like a cello. This techno song can be played in a club. The chord sequence is Gm, A7, Eb, Bb, C, F, Gm. The beat counts to 2. The tempo of this song is 128.0 beats per minute. The key of this song is G minor."
|
50 |
-
["This is a new age piece. There is a flute playing the main melody with a lot of staccato notes. The rhythmic background consists of a medium tempo electronic drum beat with percussive elements all over the spectrum. There is a playful atmosphere to the piece. This piece can be used in the soundtrack of a children's TV show or an advertisement jingle."
|
51 |
-
["The song is an instrumental. The song is in medium tempo with a classical guitar playing a lilting melody in accompaniment style. The song is emotional and romantic. The song is a romantic instrumental song. The chord sequence is Gm, F6, Ebm. The time signature is 4/4. This song is in Adagio. The key of this song is G minor."
|
52 |
-
["This folk song features a female voice singing the main melody. This is accompanied by a tabla playing the percussion. A guitar strums chords. For most parts of the song, only one chord is played. At the last bar, a different chord is played. This song has minimal instruments. This song has a story-telling mood. This song can be played in a village scene in an Indian movie. The chord sequence is Bbm, Ab. The beat is 3. The tempo of this song is Allegro. The key of this song is Bb minor."
|
53 |
-
["This is a live performance of a classical music piece. There is an orchestra performing the piece with a violin lead playing the main melody. The atmosphere is sentimental and heart-touching. This piece could be playing in the background at a classy restaurant. The chord progression in this song is Am7, Gm, Dm, A7, Dm. The beat is 3. This song is in Largo. The key of this song is D minor."
|
54 |
-
["This is a techno piece with drums and beats and a leading melody. A synth plays chords. The music kicks off with a powerful and relentless drumbeat. Over the pounding beats, a leading melody emerges. In the middle of the song, a flock of seagulls flies over the venue and make loud bird sounds. It has strong danceability and can be played in a club. The tempo is 120 bpm. The chords played by the synth are Am, Cm, Dm, Gm."
|
55 |
],
|
56 |
cache_examples="lazy",
|
57 |
)
|
|
|
25 |
# Gradio input and output components
|
26 |
input_text = gr.Textbox(lines=2, label="Prompt")
|
27 |
output_audio = gr.Audio(label="Generated Music", type="filepath")
|
28 |
+
temperature = gr.Slider(minimum=0.5, maximum=1.2, value=1.0, step=0.1, label="Temperature", interactive=True)
|
|
|
29 |
|
30 |
# CSS styling for the Duplicate button
|
31 |
css = '''
|
|
|
40 |
# Gradio interface
|
41 |
gr_interface = gr.Interface(
|
42 |
fn=gradio_generate,
|
43 |
+
inputs=[input_text, temperature],
|
44 |
outputs=[output_audio],
|
45 |
description=description_text,
|
46 |
allow_flagging=False,
|
47 |
examples=[
|
48 |
+
["This techno song features a synth lead playing the main melody. This is accompanied by programmed percussion playing a simple kick focused beat. The hi-hat is accented in an open position on the 3-and count of every bar. The synth plays the bass part with a voicing that sounds like a cello. This techno song can be played in a club. The chord sequence is Gm, A7, Eb, Bb, C, F, Gm. The beat counts to 2. The tempo of this song is 128.0 beats per minute. The key of this song is G minor."],
|
49 |
+
["This is a new age piece. There is a flute playing the main melody with a lot of staccato notes. The rhythmic background consists of a medium tempo electronic drum beat with percussive elements all over the spectrum. There is a playful atmosphere to the piece. This piece can be used in the soundtrack of a children's TV show or an advertisement jingle."],
|
50 |
+
["The song is an instrumental. The song is in medium tempo with a classical guitar playing a lilting melody in accompaniment style. The song is emotional and romantic. The song is a romantic instrumental song. The chord sequence is Gm, F6, Ebm. The time signature is 4/4. This song is in Adagio. The key of this song is G minor."],
|
51 |
+
["This folk song features a female voice singing the main melody. This is accompanied by a tabla playing the percussion. A guitar strums chords. For most parts of the song, only one chord is played. At the last bar, a different chord is played. This song has minimal instruments. This song has a story-telling mood. This song can be played in a village scene in an Indian movie. The chord sequence is Bbm, Ab. The beat is 3. The tempo of this song is Allegro. The key of this song is Bb minor."],
|
52 |
+
["This is a live performance of a classical music piece. There is an orchestra performing the piece with a violin lead playing the main melody. The atmosphere is sentimental and heart-touching. This piece could be playing in the background at a classy restaurant. The chord progression in this song is Am7, Gm, Dm, A7, Dm. The beat is 3. This song is in Largo. The key of this song is D minor."],
|
53 |
+
["This is a techno piece with drums and beats and a leading melody. A synth plays chords. The music kicks off with a powerful and relentless drumbeat. Over the pounding beats, a leading melody emerges. In the middle of the song, a flock of seagulls flies over the venue and make loud bird sounds. It has strong danceability and can be played in a club. The tempo is 120 bpm. The chords played by the synth are Am, Cm, Dm, Gm."],
|
54 |
],
|
55 |
cache_examples="lazy",
|
56 |
)
|
post_install.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
import sys
|
3 |
+
|
4 |
+
def install_fluidsynth():
|
5 |
+
try:
|
6 |
+
subprocess.check_call([
|
7 |
+
'conda', 'install', '-c', 'conda-forge', 'fluidsynth', '-y'
|
8 |
+
])
|
9 |
+
except subprocess.CalledProcessError as e:
|
10 |
+
sys.exit(e.returncode)
|
11 |
+
|
12 |
+
if __name__ == "__main__":
|
13 |
+
install_fluidsynth()
|
setup.txt
CHANGED
@@ -1,7 +1,24 @@
|
|
1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
requirement_path = "requirements.txt"
|
3 |
install_requires = []
|
4 |
if os.path.isfile(requirement_path):
|
5 |
with open(requirement_path) as f:
|
6 |
install_requires = f.read().splitlines()
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
from setuptools import setup
|
3 |
+
from setuptools.command.install import install
|
4 |
+
|
5 |
+
class CustomInstallCommand(install):
|
6 |
+
def run(self):
|
7 |
+
install.run(self)
|
8 |
+
# Run the post-install script
|
9 |
+
os.system('python post_install.py')
|
10 |
+
|
11 |
requirement_path = "requirements.txt"
|
12 |
install_requires = []
|
13 |
if os.path.isfile(requirement_path):
|
14 |
with open(requirement_path) as f:
|
15 |
install_requires = f.read().splitlines()
|
16 |
+
|
17 |
+
setup(
|
18 |
+
name="mypackage",
|
19 |
+
install_requires=install_requires,
|
20 |
+
cmdclass={
|
21 |
+
'install': CustomInstallCommand,
|
22 |
+
},
|
23 |
+
# ... other setup options ...
|
24 |
+
)
|