AngelinaZanardi commited on
Commit
f1787c5
·
verified ·
1 Parent(s): b3c44fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -28,7 +28,7 @@ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
28
  print(f"Bruker enhet: {device}")
29
 
30
  @spaces.GPU(duration=60 * 2)
31
- def pipe(file, return_timestamps=False,lang="no"):
32
  asr = pipeline(
33
  task="automatic-speech-recognition",
34
  model=MODEL_NAME,
@@ -74,10 +74,10 @@ def transcribe(file, return_timestamps=False,lang_nn=False):
74
 
75
  if not lang_nn:
76
  if not return_timestamps:
77
- text = pipe(file_to_transcribe,lang="no")["text"]
78
  formatted_text = format_output(text)
79
  else:
80
- chunks = pipe(file_to_transcribe, return_timestamps=True,lang="no")["chunks"]
81
  text = []
82
  for chunk in chunks:
83
  start_time = time.strftime('%H:%M:%S', time.gmtime(chunk["timestamp"][0])) if chunk["timestamp"][0] is not None else "??:??:??"
 
28
  print(f"Bruker enhet: {device}")
29
 
30
  @spaces.GPU(duration=60 * 2)
31
+ def pipe(file, return_timestamps=False,lang="nn"):
32
  asr = pipeline(
33
  task="automatic-speech-recognition",
34
  model=MODEL_NAME,
 
74
 
75
  if not lang_nn:
76
  if not return_timestamps:
77
+ text = pipe(file_to_transcribe)["text"]
78
  formatted_text = format_output(text)
79
  else:
80
+ chunks = pipe(file_to_transcribe, return_timestamps=True)["chunks"]
81
  text = []
82
  for chunk in chunks:
83
  start_time = time.strftime('%H:%M:%S', time.gmtime(chunk["timestamp"][0])) if chunk["timestamp"][0] is not None else "??:??:??"