Spaces:
Sleeping
Sleeping
File size: 1,035 Bytes
1edace4 2d5e45b 7c28a23 6750a72 daba0a1 b1cb380 2d5e45b 8c469ef 7c28a23 8c469ef 2d5e45b e1f9906 1edace4 |
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 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import streamlit as st
from transformers import pipeline
import os
import io
import tempfile
import base64
from audiorecorder import audiorecorder
from openai import OpenAI
from pydub import AudioSegment
os.environ['OPENAI_API_KEY'] = "" ###add the openai key here
client = OpenAI()
st.title("Whisper App")
audio = audiorecorder("Click to record", "Click to stop recording")
if len(audio) > 0:
temp_dir = tempfile.mkdtemp()
temp_file_path = os.path.join(temp_dir, 'temp_audio.wav')
audio.export(temp_file_path, format=".wav")
print(audio)
song = AudioSegment.from_wav("temp_audio.wav")
song.export("temp_audio", format = "flac")
######################## models
# model = pipeline("sentiment-analysis")
# st.title("Hugging Face Model Demo")
# input_text = st.text_input("Enter your text", "")
# if st.button("Analyze"):
# # Perform inference using the loaded model
# result = model(input_text)
# st.write("Prediction:", result[0]['label'], "| Score:", result[0]['score'])
|