yellowcandle commited on
Commit
3d7bd2f
1 Parent(s): bca5261

rty to fix errors

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -14,7 +14,7 @@ def transcribe_audio(audio):
14
  if audio is None:
15
  return "Please upload an audio file."
16
  if transcribe_model is None:
17
- return "Please select a model."
18
 
19
  device = "cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
20
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
@@ -41,6 +41,8 @@ def proofread(text):
41
  global proofread_model
42
  if text is None:
43
  return "Please provide the transcribed text for proofreading."
 
 
44
 
45
  device = "cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
46
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
@@ -77,7 +79,7 @@ def load_models(transcribe_model_id, proofread_model_id):
77
  with gr.Blocks() as demo:
78
  gr.Markdown("""
79
  # Audio Transcription and Proofreading
80
- 1. Select models for transcription and proofreading
81
  2. Upload an audio file (Wait for the file to be fully loaded first)
82
  3. Transcribe the audio
83
  4. Proofread the transcribed text
 
14
  if audio is None:
15
  return "Please upload an audio file."
16
  if transcribe_model is None:
17
+ return "Please load the transcription model first."
18
 
19
  device = "cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
20
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
 
41
  global proofread_model
42
  if text is None:
43
  return "Please provide the transcribed text for proofreading."
44
+ if proofread_model is None:
45
+ return "Please load the proofreading model first."
46
 
47
  device = "cuda:0" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu"
48
  torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
 
79
  with gr.Blocks() as demo:
80
  gr.Markdown("""
81
  # Audio Transcription and Proofreading
82
+ 1. Select models for transcription and proofreading and load them
83
  2. Upload an audio file (Wait for the file to be fully loaded first)
84
  3. Transcribe the audio
85
  4. Proofread the transcribed text