Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,18 +137,17 @@ def main():
|
|
| 137 |
if st.button("🎵 Transcribe Audio"):
|
| 138 |
with st.spinner("Transcribing audio..."):
|
| 139 |
try:
|
|
|
|
| 140 |
if use_hf:
|
| 141 |
transcriber = HFTranscriber(model_name=model_name)
|
| 142 |
else:
|
| 143 |
transcriber = AudioTranscriber()
|
| 144 |
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
try:
|
| 152 |
# Transcribe
|
| 153 |
transcriber.transcribe(audio_file, midi_output, musicxml_output)
|
| 154 |
|
|
|
|
| 137 |
if st.button("🎵 Transcribe Audio"):
|
| 138 |
with st.spinner("Transcribing audio..."):
|
| 139 |
try:
|
| 140 |
+
# Initialize the transcriber
|
| 141 |
if use_hf:
|
| 142 |
transcriber = HFTranscriber(model_name=model_name)
|
| 143 |
else:
|
| 144 |
transcriber = AudioTranscriber()
|
| 145 |
|
| 146 |
+
# Create output directory
|
| 147 |
+
os.makedirs("outputs", exist_ok=True)
|
| 148 |
+
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 149 |
+
midi_output = os.path.join("outputs", f"output_{timestamp}.mid")
|
| 150 |
+
musicxml_output = os.path.join("outputs", f"output_{timestamp}.musicxml")
|
|
|
|
|
|
|
| 151 |
# Transcribe
|
| 152 |
transcriber.transcribe(audio_file, midi_output, musicxml_output)
|
| 153 |
|