Spaces:
Sleeping
Sleeping
import streamlit as st | |
from audiorecorder import audiorecorder | |
import openai | |
import os | |
# Nastavení klíče API pro OpenAI | |
openai.api_key = os.environ['OPENAI_API_KEY'] | |
def transcribe(audio_data): | |
""" | |
Transkribuje audio data pomocí Whisper API. | |
""" | |
response = openai.Audio.transcribe("whisper-1", audio_data, filename='1.mp3') | |
return response["text"] | |
# Streamlit aplikace | |
st.title("Audio Transkriptor") | |
# Nahrávání audia | |
st.markdown("Nahrajte svůj hlasový záznam.") | |
audio_data = audiorecorder("Record", "Stop") | |
# Zpracování a zobrazení transkripce | |
if audio_data is not None and len(audio_data) > 0: | |
with st.spinner('Probíhá transkripce...'): | |
transcript = transcribe(audio_data.tobytes()) | |
st.text_area("Transkript", value=transcript, height=300) | |