Spaces:
Sleeping
Sleeping
Commit ·
e00da4e
1
Parent(s): 4b1d890
Fix : added the main.py file
Browse filesFiles changed (4)
- .gitignoreAdded+1
- Readme.mdAdded+17
- main.pyAdded+54
- requirements.txtAdded+6
1.env1234567891011121314151617## Steps to reproduce the repo
## Start with Python 3.11.8 new environment or use conda to create new env with python 3.11.8
## Commands to start with Conda
## conda create -n AudioAnalyze python=3.11.8
## Command to activate conda env
## conda activate AudioAnalyze
## Install requirements using pip
## pip install -r requirements.txt
## Run main.py file123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import gradio as grimport osimport osfrom dotenv import load_dotenv
from deepgram import ( DeepgramClient, PrerecordedOptions, FileSource,)
load_dotenv()
API_KEY = os.getenv("DEEPGRAM_KEY")
def process_mp3(file_info): try: deepgram = DeepgramClient(API_KEY)
with open(file_info, "rb") as file: buffer_data = file.read()
payload: FileSource = { "buffer": buffer_data, }
options = PrerecordedOptions( model="base", diarize = True, smart_format=True )
response = deepgram.listen.prerecorded.v("1").transcribe_file(payload, options)
except Exception as e: print(f"Exception: {e}")
return response.results.channels[0].alternatives[0].paragraphs.transcript
def main(): # Define the Gradio interface iface = gr.Interface( fn=process_mp3, inputs=gr.File(label="Upload MP3 File", file_types=["mp3"]), outputs="text", title="MP3 File Uploader", description="Upload an MP3 file to process." ) # Launch the interface iface.launch()
if __name__ == "__main__": main()123456gradiodeepgram-sdkpython-dotenvlangchain-google-genailangchain
.gitignoreAdded+1
Readme.mdAdded+17
main.pyAdded+54
requirements.txtAdded+6