amirgame197 commited on
Commit
6f1bbcd
·
verified ·
1 Parent(s): 8140dfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -22
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,18 @@ 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
+ uploaded_file = st.file_uploader("", type=["wav","mp3"])
106
+ selected_stem_count = st.radio("Stem count", (2,4,5))
 
 
 
107
 
108
  if uploaded_file is not None:
109
 
110
+ with tempfile.NamedTemporaryFile(delete=False) as temp_file:
111
+ temp_file.write(uploaded_file.read())
112
+ temp_file_path = temp_file.name
 
 
 
113
 
114
+ separate_audios = separate_audio_by_stem(temp_file_path, selected_stem_count)
 
115
 
116
+ st.write("Output Files:")
117
+ for audio in separate_audios:
118
+ st.write(audio['description'])
119
+ st.audio(audio['path'], format="audio/wav", start_time=0)