Simranjit commited on
Commit
0fc0029
·
verified ·
1 Parent(s): 9129e28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -13,10 +13,10 @@ access_token_read = os.environ.get('HF_TOKEN', None)
13
  login(token = access_token_read)
14
 
15
  print("cur path", os.listdir(os.path.join("..", "..", "..")))
16
- os.mkdir(os.path.join("data", "hfcache"))
17
- os.mkdir(os.path.join("data", "audio"))
18
- os.mkdir(os.path.join("data", "audio_texts"))
19
- os.environ["HF_HOME"] = os.path.join("data/hfcache")
20
 
21
 
22
  transcriber = pipeline("automatic-speech-recognition", model='Simranjit/whisper-medical-french', device="cuda")
@@ -41,10 +41,10 @@ def save_fn(audio, text):
41
 
42
  uid = str(uuid.uuid4())
43
 
44
- with open(os.path.join("data", "audio_texts", f"{uid}.txt"), "w", encoding="utf-8") as f:
45
  f.write(text)
46
 
47
- write(os.path.join("data", "audio", f"{uid}.wav"), sr, y)
48
  return [None, ""]
49
 
50
  with gr.Blocks() as demo:
 
13
  login(token = access_token_read)
14
 
15
  print("cur path", os.listdir(os.path.join("..", "..", "..")))
16
+ os.mkdir(os.path.join("..", "..", "..", "data", "hfcache"))
17
+ os.mkdir(os.path.join("..", "..", "..", "data", "audio"))
18
+ os.mkdir(os.path.join("..", "..", "..", "data", "audio_texts"))
19
+ os.environ["HF_HOME"] = os.path.join("..", "..", "..", "data", "hfcache")
20
 
21
 
22
  transcriber = pipeline("automatic-speech-recognition", model='Simranjit/whisper-medical-french', device="cuda")
 
41
 
42
  uid = str(uuid.uuid4())
43
 
44
+ with open(os.path.join("..", "..", "..", "data", "audio_texts", f"{uid}.txt"), "w", encoding="utf-8") as f:
45
  f.write(text)
46
 
47
+ write(os.path.join("..", "..", "..", "data", "audio", f"{uid}.wav"), sr, y)
48
  return [None, ""]
49
 
50
  with gr.Blocks() as demo: