yanielbf commited on
Commit
2455e8f
1 Parent(s): 6788835

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -44,13 +44,13 @@ def transcribe_task():
44
  file.write(blob.download_blob().readall())
45
  pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
46
  print("Call pipeline...")
47
- text = pipe('audio22.mp3', return_timestamps=True)
48
- print(text)
49
  with open('new_file.txt', "w") as file:
50
- file.write(text)
51
- except:
52
  with open('new_file.txt', "w") as file:
53
- file.write("Error")
54
 
55
  @app.get("/transcribe")
56
  async def transcribe(background_tasks: BackgroundTasks):
 
44
  file.write(blob.download_blob().readall())
45
  pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
46
  print("Call pipeline...")
47
+ res = pipe('audio22.mp3', return_timestamps=True)
48
+ print(res['text'])
49
  with open('new_file.txt', "w") as file:
50
+ file.write(res['text'])
51
+ except Exception as e:
52
  with open('new_file.txt', "w") as file:
53
+ file.write(str(e))
54
 
55
  @app.get("/transcribe")
56
  async def transcribe(background_tasks: BackgroundTasks):