Spaces:
Runtime error
Runtime error
File size: 2,457 Bytes
8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 b073205 8fe64f7 fad63af 8fe64f7 fad63af b073205 8fe64f7 b073205 fad63af 6e20c4b 8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 fad63af 8fe64f7 2226010 8fe64f7 fad63af 8fe64f7 |
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
import os
import streamlit as st
from dotenv import load_dotenv
from engines import get_engine
import api
# Load environment variables from .env file before importing any other modules
load_dotenv()
def main():
st.set_page_config(
page_title='Note Taker',
page_icon='๐๏ธ',
layout='centered',
initial_sidebar_state='expanded',
)
title = '๐๏ธ Meetings Note Taker ๐๏ธ'
st.title(title)
st.write(
'Upload an audio file, transcribe it using WhisperX or AssemblyAI, and generate meeting notes using your selected model.'
)
openai_api_key = os.environ.get('OPENAI_API_KEY') or st.text_input(
'Enter your OpenAI API key:', type='password'
)
engine_type = os.environ.get('TRANSCRIPTION_ENGINE') or st.selectbox(
'Select a transcription engine:', ['WhisperX', 'AssemblyAI']
)
engine_api_key = os.environ.get(
f'{engine_type.upper()}_API_KEY'
) or st.text_input(f'Enter your {engine_type} API key:', type='password')
openai_model = os.environ.get('OPENAI_MODEL') or st.selectbox(
'Select a model:', ['gpt-3.5-turbo-16k', 'gpt-4-0613']
)
uploaded_audio = st.file_uploader(
'Upload an audio file',
type=['aac', 'm4a', 'mp3', 'webm', 'mp4', 'mpga', 'wav', 'mpeg'],
accept_multiple_files=False,
)
language = os.environ.get('AUDIO_LANGUAGE') or st.selectbox(
'Language code of the audio:', ['en', 'es']
)
if st.button('Generate Notes'):
if uploaded_audio:
if openai_api_key:
st.markdown('Transcribing the audio...')
engine = get_engine(engine_type, engine_api_key)
transcription = api.transcribe(engine, language, uploaded_audio)
st.markdown(
f'### Transcription:\n\n<details><summary>Click to view</summary><p><pre><code>{transcription}</code></pre></p></details>',
unsafe_allow_html=True,
)
st.markdown('Summarizing the transcription...')
summary = api.summarize_transcript(
openai_api_key,
transcription,
openai_model,
)
st.markdown(f'### Summary:')
st.write(summary)
else:
st.error('We need valid OpenAI API keys')
if __name__ == '__main__':
main()
|