amirgame197 commited on
Commit
79c4319
·
verified ·
1 Parent(s): a8d61bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -20
app.py CHANGED
@@ -3,10 +3,6 @@ import os
3
  import tempfile
4
  import subprocess
5
 
6
- # Set Streamlit app title
7
- st.title("Audio Separation App")
8
-
9
- # Function to process the audio file
10
  def separate_audio(audio_path):
11
 
12
  print(f"{audio_path=}")
@@ -106,26 +102,24 @@ def separate_audio_by_stem(audio_path, stem_count):
106
  {'description': 'Other', 'path':other_path},
107
  ]
108
 
109
- # Streamlit app content
110
- st.write("Upload an audio file")
111
 
112
- uploaded_file = st.file_uploader("Choose a file", type=["wav","mp3"])
113
- selected_stem_count = st.radio("Select stem count", (2,4,5))
114
 
115
  if uploaded_file is not None:
116
 
117
- if st.button("Submit"):
118
 
119
- # Save the uploaded file to a temporary location
120
- with tempfile.NamedTemporaryFile(delete=False) as temp_file:
121
- temp_file.write(uploaded_file.read())
122
- temp_file_path = temp_file.name
123
 
124
- # Process the uploaded audio file
125
- separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
126
 
127
- # Display the output files for download
128
- st.write("Output Files:")
129
- for audio in separate_audios:
130
- st.write(audio['description'])
131
- st.audio(audio['path'], format="audio/wav", start_time=0)
 
3
  import tempfile
4
  import subprocess
5
 
 
 
 
 
6
  def separate_audio(audio_path):
7
 
8
  print(f"{audio_path=}")
 
102
  {'description': 'Other', 'path':other_path},
103
  ]
104
 
 
 
105
 
106
+ uploaded_file = st.file_uploader("", type=["wav","mp3"])
107
+ selected_stem_count = 2
108
 
109
  if uploaded_file is not None:
110
 
111
+ #if st.button("Submit"):
112
 
113
+ # Save the uploaded file to a temporary location
114
+ with tempfile.NamedTemporaryFile(delete=False) as temp_file:
115
+ temp_file.write(uploaded_file.read())
116
+ temp_file_path = temp_file.name
117
 
118
+ # Process the uploaded audio file
119
+ separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
120
 
121
+ # Display the output files for download
122
+ st.write("Output Files:")
123
+ for audio in separate_audios:
124
+ st.write(audio['description'])
125
+ st.audio(audio['path'], format="audio/wav", start_time=0)