yanielbf commited on
Commit
1811b97
·
1 Parent(s): 7e5e2c3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -7
main.py CHANGED
@@ -20,7 +20,9 @@ translate_token_id = all_special_ids[-6]
20
  def transcribe(file):
21
  pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
22
  text = pipe(file, return_timestamps=True)
23
-
 
 
24
  return text
25
 
26
  app = FastAPI()
@@ -30,9 +32,10 @@ def transcribe(background_tasks: BackgroundTasks, file: UploadFile = File(...)):
30
  background_tasks.add_task(transcribe, file)
31
  return {"text": "Processing file..."}
32
 
33
- @app.get("/")
34
- def read_root():
35
- file_path = "/home/user/data/new_file.txt"
36
- with open(file_path, "w") as file:
37
- file.write("¡Hola, mundo!")
38
- return {"text": "World!"}
 
 
20
  def transcribe(file):
21
  pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id]]
22
  text = pipe(file, return_timestamps=True)
23
+ file_path = '/home/user/data/new_file.txt'
24
+ with open(file_path, "w") as file:
25
+ file.write(text)
26
  return text
27
 
28
  app = FastAPI()
 
32
  background_tasks.add_task(transcribe, file)
33
  return {"text": "Processing file..."}
34
 
35
+ @app.get("/get-text")
36
+ def get_text():
37
+ file = open('/home/user/data/new_file.txt', 'r')
38
+ content = file.read()
39
+ file.close()
40
+
41
+ return {"text": content}