Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,53 +1,3 @@
|
|
| 1 |
-
# import streamlit as st
|
| 2 |
-
# import whisper
|
| 3 |
-
# import tempfile
|
| 4 |
-
# import os
|
| 5 |
-
# import torchaudio
|
| 6 |
-
|
| 7 |
-
# # Title and description
|
| 8 |
-
# st.title("🎧 Whisper Audio Transcriber")
|
| 9 |
-
# st.markdown("Upload a `.wav` or `.mp3` file to get transcribed text with timestamps using Whisper.")
|
| 10 |
-
|
| 11 |
-
# # Load Whisper model
|
| 12 |
-
# @st.cache_resource
|
| 13 |
-
# def load_model():
|
| 14 |
-
# return whisper.load_model("base")
|
| 15 |
-
|
| 16 |
-
# model = load_model()
|
| 17 |
-
# st.success("✅ Whisper model loaded!")
|
| 18 |
-
|
| 19 |
-
# # File uploader
|
| 20 |
-
# audio_file = st.file_uploader("Upload audio file", type=["wav", "mp3"])
|
| 21 |
-
|
| 22 |
-
# if audio_file is not None:
|
| 23 |
-
# # Save uploaded file temporarily
|
| 24 |
-
# with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as tmp_file:
|
| 25 |
-
# tmp_file.write(audio_file.read())
|
| 26 |
-
# temp_path = tmp_file.name
|
| 27 |
-
|
| 28 |
-
# # Convert MP3 to WAV if needed
|
| 29 |
-
# if audio_file.name.endswith(".mp3"):
|
| 30 |
-
# waveform, sample_rate = torchaudio.load(temp_path)
|
| 31 |
-
# wav_path = temp_path.replace(".wav", "_converted.wav")
|
| 32 |
-
# torchaudio.save(wav_path, waveform, sample_rate)
|
| 33 |
-
# os.remove(temp_path)
|
| 34 |
-
# temp_path = wav_path
|
| 35 |
-
|
| 36 |
-
# # Transcription
|
| 37 |
-
# st.info("📝 Transcribing...")
|
| 38 |
-
# result = model.transcribe(temp_path)
|
| 39 |
-
|
| 40 |
-
# # Display segments
|
| 41 |
-
# st.subheader("🕒 Segments with Timestamps")
|
| 42 |
-
# for segment in result["segments"]:
|
| 43 |
-
# st.markdown(f"**[{segment['start']:.2f}s - {segment['end']:.2f}s]**: {segment['text']}")
|
| 44 |
-
|
| 45 |
-
# # Full transcription
|
| 46 |
-
# st.subheader("🧾 Full Transcript")
|
| 47 |
-
# st.text_area("Transcribed Text", result["text"], height=250)
|
| 48 |
-
|
| 49 |
-
# # Clean up
|
| 50 |
-
# os.remove(temp_path)
|
| 51 |
import streamlit as st
|
| 52 |
import whisper
|
| 53 |
import tempfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import whisper
|
| 3 |
import tempfile
|