bluenevus commited on
Commit
aa497bf
·
verified ·
1 Parent(s): c982392

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -107,9 +107,12 @@ def transcribe_video(url):
107
  if len(transcript) < 10:
108
  raise ValueError("Transcription too short, possibly failed")
109
 
 
 
 
110
  return transcript
111
  except Exception as e:
112
- error_message = f"An error occurred: {str(e)}"
113
  logger.error(error_message)
114
  return error_message
115
 
@@ -149,6 +152,7 @@ def update_transcription(n_clicks, url):
149
  def transcribe():
150
  try:
151
  transcript = transcribe_video(url)
 
152
  return transcript
153
  except Exception as e:
154
  logger.exception("Error in transcription:")
@@ -160,11 +164,14 @@ def update_transcription(n_clicks, url):
160
  thread.join(timeout=600) # 10 minutes timeout
161
 
162
  if thread.is_alive():
 
163
  return "Transcription timed out after 10 minutes", {'display': 'none'}
164
 
165
  transcript = getattr(thread, 'result', "Transcription failed")
 
166
 
167
  if transcript and not transcript.startswith("An error occurred"):
 
168
  return dbc.Card([
169
  dbc.CardBody([
170
  html.H5("Transcription Result"),
@@ -172,6 +179,7 @@ def update_transcription(n_clicks, url):
172
  ])
173
  ]), {'display': 'block'}
174
  else:
 
175
  return transcript, {'display': 'none'}
176
 
177
  @app.callback(
 
107
  if len(transcript) < 10:
108
  raise ValueError("Transcription too short, possibly failed")
109
 
110
+ logger.info(f"Transcription successful. Length: {len(transcript)} characters")
111
+ logger.info(f"First 100 characters of transcript: {transcript[:100]}...")
112
+
113
  return transcript
114
  except Exception as e:
115
+ error_message = f"An error occurred in transcribe_video: {str(e)}"
116
  logger.error(error_message)
117
  return error_message
118
 
 
152
  def transcribe():
153
  try:
154
  transcript = transcribe_video(url)
155
+ logger.info(f"Transcription completed. Result length: {len(transcript)} characters")
156
  return transcript
157
  except Exception as e:
158
  logger.exception("Error in transcription:")
 
164
  thread.join(timeout=600) # 10 minutes timeout
165
 
166
  if thread.is_alive():
167
+ logger.warning("Transcription timed out after 10 minutes")
168
  return "Transcription timed out after 10 minutes", {'display': 'none'}
169
 
170
  transcript = getattr(thread, 'result', "Transcription failed")
171
+ logger.info(f"Final transcript length: {len(transcript)} characters")
172
 
173
  if transcript and not transcript.startswith("An error occurred"):
174
+ logger.info("Transcription successful, returning result")
175
  return dbc.Card([
176
  dbc.CardBody([
177
  html.H5("Transcription Result"),
 
179
  ])
180
  ]), {'display': 'block'}
181
  else:
182
+ logger.error(f"Transcription failed: {transcript}")
183
  return transcript, {'display': 'none'}
184
 
185
  @app.callback(