Spaces:
Running
Running
Updated samples
Browse files- app.py +55 -19
- sound/sample_conditions_1.wav +0 -0
- sound/sample_conditions_1old.wav +0 -0
- sound/sample_conditions_2.wav +0 -0
app.py
CHANGED
@@ -130,7 +130,7 @@ def save_file(model, audio_values, filename):
|
|
130 |
# Main Code
|
131 |
st.title("Plant Orchestra 🌿")
|
132 |
st.markdown("Generate music based on your own terrarium plants.")
|
133 |
-
prompt = st.
|
134 |
if st.button("Generate Music"):
|
135 |
if processor is not None and model is not None:
|
136 |
with st.spinner("Generating audio..."):
|
@@ -141,29 +141,65 @@ if st.button("Generate Music"):
|
|
141 |
st.audio(sample_rate=sampling_rate, data=results[0, 0].cpu().numpy(), format="audio/wav")
|
142 |
|
143 |
|
144 |
-
# Sidebar: How-to-use
|
145 |
st.sidebar.header("How to Use:")
|
146 |
st.sidebar.write("1. Enter data collected from terrarium in the text input.")
|
147 |
st.sidebar.write("2. Click the 'Generate Music' button to create music based on the provided input.")
|
148 |
st.sidebar.write("3. You can listen to the generated music and download it.")
|
149 |
-
st.sidebar.
|
|
|
|
|
150 |
st.sidebar.header('Samples 🎵')
|
151 |
-
|
152 |
-
st.sidebar.
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
st.sidebar.audio('sound/
|
163 |
-
st.sidebar.
|
164 |
-
|
165 |
-
|
166 |
-
st.sidebar.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
|
169 |
# Footer
|
|
|
130 |
# Main Code
|
131 |
st.title("Plant Orchestra 🌿")
|
132 |
st.markdown("Generate music based on your own terrarium plants.")
|
133 |
+
prompt = st.text_area(label='Data collected from terrarium:', placeholder='Enter data here...')
|
134 |
if st.button("Generate Music"):
|
135 |
if processor is not None and model is not None:
|
136 |
with st.spinner("Generating audio..."):
|
|
|
141 |
st.audio(sample_rate=sampling_rate, data=results[0, 0].cpu().numpy(), format="audio/wav")
|
142 |
|
143 |
|
144 |
+
# Sidebar: How-to-use
|
145 |
st.sidebar.header("How to Use:")
|
146 |
st.sidebar.write("1. Enter data collected from terrarium in the text input.")
|
147 |
st.sidebar.write("2. Click the 'Generate Music' button to create music based on the provided input.")
|
148 |
st.sidebar.write("3. You can listen to the generated music and download it.")
|
149 |
+
st.sidebar.markdown('#')
|
150 |
+
|
151 |
+
# Sidebar: Samples
|
152 |
st.sidebar.header('Samples 🎵')
|
153 |
+
# Sample 1
|
154 |
+
st.sidebar.write("""
|
155 |
+
Data:\n
|
156 |
+
holland moss, bioelectric levels: 2.1 watts\n
|
157 |
+
oak leaf fig, bioelectric levels: 3.7 watts\n
|
158 |
+
baby tears, bioelectric levels: 2.5 watts\n
|
159 |
+
pilea, bioelectric levels: 1.2 watts\n
|
160 |
+
temperature: 30C\n
|
161 |
+
humidity: 90%\n
|
162 |
+
ultraviolet index: 3
|
163 |
+
""")
|
164 |
+
st.sidebar.audio('sound/sample_conditions_1.wav')
|
165 |
+
st.sidebar.markdown('---')
|
166 |
+
|
167 |
+
# Sample 2
|
168 |
+
st.sidebar.write("""
|
169 |
+
Data:\n
|
170 |
+
hydrocotyle tripartita, bioelectric levels: 3.5 watts\n
|
171 |
+
malayan moss, bioelectric levels: 5.3 watts\n
|
172 |
+
artillery plant, bioelectric levels: 1.7 watts\n
|
173 |
+
nerve plant, bioelectric levels: 1.8 watts\n
|
174 |
+
temperature: 32C\n
|
175 |
+
humidity: 84%\n
|
176 |
+
ultraviolet index: 2
|
177 |
+
""")
|
178 |
+
st.sidebar.audio('sound/sample_conditions_2.wav')
|
179 |
+
st.sidebar.markdown('---')
|
180 |
+
|
181 |
+
# Option to hear more audios
|
182 |
+
show_more_plant_audio = st.sidebar.checkbox('Show more audios of terrarium plants')
|
183 |
+
if show_more_plant_audio:
|
184 |
+
st.sidebar.write('Holland moss')
|
185 |
+
st.sidebar.audio('sound/holland_moss.wav')
|
186 |
+
st.sidebar.write('Nerve plant')
|
187 |
+
st.sidebar.audio('sound/nerve_plant.wav')
|
188 |
+
st.sidebar.write('Baby tears')
|
189 |
+
st.sidebar.audio('sound/baby_tears.wav')
|
190 |
+
st.sidebar.write('Artillery plant')
|
191 |
+
st.sidebar.audio('sound/artillery_plant.wav')
|
192 |
+
st.sidebar.write('Malayan moss')
|
193 |
+
st.sidebar.audio('sound/malayan_moss.wav')
|
194 |
+
st.sidebar.write('Pilea')
|
195 |
+
st.sidebar.audio('sound/pilea.wav')
|
196 |
+
st.sidebar.write('Hydrocotyle tripartita')
|
197 |
+
st.sidebar.audio('sound/hydrocotyle_tripartita.wav')
|
198 |
+
st.sidebar.write('Oak leaf fig')
|
199 |
+
st.sidebar.audio('sound/oak_leaf_fig.wav')
|
200 |
+
|
201 |
+
st.sidebar.markdown('---')
|
202 |
+
st.sidebar.write("This app is built with [MusicGen by Meta](https://ai.meta.com/resources/models-and-libraries/audiocraft/).")
|
203 |
|
204 |
|
205 |
# Footer
|
sound/sample_conditions_1.wav
ADDED
Binary file (324 kB). View file
|
|
sound/sample_conditions_1old.wav
ADDED
Binary file (324 kB). View file
|
|
sound/sample_conditions_2.wav
ADDED
Binary file (324 kB). View file
|
|