Spaces:
Runtime error
Runtime error
File size: 794 Bytes
18214ff |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import streamlit as st
from streamlit import session_state
import tempfile
from pathlib import Path
st.set_page_config(
page_title="Speech Recognision",
page_icon="📈",
)
from openai import OpenAI
client = OpenAI()
uploaded_file = st.file_uploader("Choose a file")
if uploaded_file is not None:
# Make temp file path from uploaded file
with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
fp = Path(tmp_file.name)
fp.write_bytes(uploaded_file.getvalue())
print(tmp_file.name,"path_")
audio_file= open(tmp_file.name, "rb")
transcript_english = client.audio.translations.create(
model="whisper-1",
file=audio_file,temperature = 0)
st.text_area("Transcription", value=transcript_english.text)
|