Spaces:
Running
Running
divakaivan
commited on
Delete app_old.py
Browse files- app_old.py +0 -29
app_old.py
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from st_audiorec import st_audiorec
|
3 |
-
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
|
4 |
-
|
5 |
-
processor = AutoProcessor.from_pretrained("openai/whisper-small")
|
6 |
-
model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-small")
|
7 |
-
|
8 |
-
def transcribe(audio):
|
9 |
-
|
10 |
-
text = processor.batch_decode(model.generate(processor(audio), num_beams=4), skip_special_tokens=True)
|
11 |
-
return text
|
12 |
-
|
13 |
-
wav_audio_data = st_audiorec()
|
14 |
-
|
15 |
-
if wav_audio_data is not None:
|
16 |
-
# st.audio(wav_audio_data, format='audio/wav')
|
17 |
-
st.write("Transcription:")
|
18 |
-
st.write(transcribe(wav_audio_data))
|
19 |
-
|
20 |
-
# Set up the Streamlit app
|
21 |
-
st.title("Glaswegian Transcription with Whisper")
|
22 |
-
api_key = st.sidebar.text_input("Enter your API key")
|
23 |
-
|
24 |
-
# Check if API key is provided
|
25 |
-
if api_key:
|
26 |
-
st.write("API key:", api_key)
|
27 |
-
# Add your code here to use the Whisper model for audio transcription
|
28 |
-
else:
|
29 |
-
st.warning("Please enter your API key in the sidebar.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|