Spaces:
Build error
Build error
| import streamlit as st | |
| import subprocess | |
| def run_makefile(): | |
| result = subprocess.run(["make"], capture_output=True, text=True) | |
| if result.returncode == 0: | |
| st.success(f"Makefile executed successfully:\n{result.stdout}") | |
| else: | |
| st.error(f"Makefile execution failed:\n{result.stderr}") | |
| st.title("Run Makefile") | |
| if st.button("Run Makefile"): | |
| run_makefile() | |
| '''import streamlit as st | |
| import time | |
| import soundfile as sf | |
| from whisper_processor import process_audio | |
| def process_audio_streamlit(audio_file, model_name, lang): | |
| start_time = time.time() | |
| # Read audio data | |
| audio, sample_rate = sf.read(audio_file) | |
| # Check if conversion is necessary | |
| if sample_rate != 16000: | |
| # Resample to 16kHz | |
| audio = sf.resample(audio, sample_rate, 16000) | |
| # Save the resampled audio (optional) | |
| # sf.write("temp_resampled.wav", audio, 16000) | |
| # Process the audio with Whisper | |
| result = process_audio(audio, model_name=model_name, lang=lang) | |
| end_time = time.time() | |
| elapsed_time = end_time - start_time | |
| st.write("Time taken:", elapsed_time, "seconds") | |
| return result | |
| st.title("Audio Transcription") | |
| # Upload audio file | |
| uploaded_file = st.file_uploader("Choose an audio file") | |
| # Select model and language | |
| model_name = st.selectbox("Select model", ["tiny", "base", "small", "medium", "large"]) | |
| lang = st.selectbox("Select language", ["en", "hi", "fr", "de", "es", "it", "pt", "ru", "zh", "ja", "ko", "ar", "tr"]) | |
| if uploaded_file is not None: | |
| # Save the uploaded file to a temporary location | |
| with open("temp.wav", "wb") as f: | |
| f.write(uploaded_file.read()) | |
| # Process the audio file | |
| result = process_audio_streamlit("temp.wav", model_name, lang) | |
| # Display the transcription result | |
| st.write("Transcription:") | |
| st.text_area("", value=result, height=300)''' |