bluenevus commited on
Commit
4ed1e63
·
verified ·
1 Parent(s): 82b85b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -46,8 +46,6 @@ if not OPENAI_API_KEY:
46
 
47
  openai.api_key = OPENAI_API_KEY
48
 
49
- # Add this function definition after the other helper functions and before the app layout
50
-
51
  def process_media(contents, filename, url):
52
  logger.info("Starting media processing")
53
  try:
@@ -80,6 +78,17 @@ def process_media(contents, filename, url):
80
  logger.error(f"Error in process_media: {str(e)}")
81
  raise
82
 
 
 
 
 
 
 
 
 
 
 
 
83
  app.layout = dbc.Container([
84
  dbc.Row([
85
  dbc.Col([
 
46
 
47
  openai.api_key = OPENAI_API_KEY
48
 
 
 
49
  def process_media(contents, filename, url):
50
  logger.info("Starting media processing")
51
  try:
 
78
  logger.error(f"Error in process_media: {str(e)}")
79
  raise
80
 
81
+ def transcribe_audio(file_path):
82
+ logger.info(f"Transcribing audio: {file_path}")
83
+ try:
84
+ with open(file_path, "rb") as audio_file:
85
+ transcript = openai.Audio.transcribe("whisper-1", audio_file)
86
+ logger.info("Transcription completed successfully")
87
+ return transcript["text"]
88
+ except Exception as e:
89
+ logger.error(f"Error during transcription: {str(e)}")
90
+ raise
91
+
92
  app.layout = dbc.Container([
93
  dbc.Row([
94
  dbc.Col([