majweldon commited on
Commit
7ffd1df
·
verified ·
1 Parent(s): c664abc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -28,20 +28,19 @@ def transcribe(audio, history_type):
28
  print(f"Received audio file path: {audio}")
29
 
30
  history_type_map = {
31
- "History": "Weldon_History_Format.txt",
32
- "Physical": "Weldon_PE_Note_Format.txt",
33
- "H+P": "Weldon_History_Physical_Format.txt",
34
  "Impression/Plan": "Weldon_Impression_Note_Format.txt",
35
  "Handover": "Weldon_Handover_Note_Format.txt",
36
  "Meds Only": "Medications.txt",
37
- "EMS": "EMS_Handover_Note_Format.txt",
38
  "Triage": "Triage_Note_Format.txt",
39
- "Full Visit": "Weldon_Full_Visit_Format_HTML.txt",
40
  "Psych": "Weldon_Psych_Format.txt",
41
- "SBAR": "SBAR.txt"
 
 
42
 
43
  }
44
- file_name = history_type_map.get(history_type, "Weldon_Full_Visit_Format.txt")
 
45
  with open(f"Format_Library/{file_name}", "r") as f:
46
  role = f.read()
47
  messages = [{"role": "system", "content": role}]
@@ -75,12 +74,6 @@ def transcribe(audio, history_type):
75
  # print(f"###############Failed to open audio file after {max_attempts} attempts.##############")
76
  # return # Terminate the function or raise an exception if the file could not be opened
77
 
78
-
79
- ########## Cast as float 32, normalize
80
- #audio_data = audio_data.astype("float32")
81
- #audio_data = (audio_data * 32767).astype("int16")
82
- #audio_data = audio_data.mean(axis=1)
83
-
84
  ###################Code to convert .wav to .mp3 (if neccesary)
85
  sf.write("Audio_Files/test.wav", audio_data, samplerate, subtype='PCM_16')
86
  sound = AudioSegment.from_wav("Audio_Files/test.wav")
@@ -140,7 +133,7 @@ my_inputs = [
140
  #gr.Audio(sources=["microphone"], type="filepath",format="wav"), #Gradio 4.x
141
  #gr.Audio(sources=["microphone"],type="numpy",editable="false"), #Gradio 4.x
142
  gr.Microphone(type="numpy"), #Gradio 4.x
143
- gr.Radio(["History","H+P","Impression/Plan","Full Visit","Handover","Psych","EMS","SBAR","Meds Only"], show_label=False),
144
  ]
145
 
146
  ui = gr.Interface(fn=transcribe,
 
28
  print(f"Received audio file path: {audio}")
29
 
30
  history_type_map = {
 
 
 
31
  "Impression/Plan": "Weldon_Impression_Note_Format.txt",
32
  "Handover": "Weldon_Handover_Note_Format.txt",
33
  "Meds Only": "Medications.txt",
 
34
  "Triage": "Triage_Note_Format.txt",
35
+ "Full Visit": "Weldon_Full_Visit_Format.txt",
36
  "Psych": "Weldon_Psych_Format.txt",
37
+ "Weldon_Feedback_Format.txt",
38
+ "Weldon_Dx_DDx_Format.txt",
39
+ "Weldon_Hallway_Consult_Format.txt"
40
 
41
  }
42
+
43
+ file_name = history_type_map.get(history_type, "Weldon_Full_Visit_Format_HTML.txt")
44
  with open(f"Format_Library/{file_name}", "r") as f:
45
  role = f.read()
46
  messages = [{"role": "system", "content": role}]
 
74
  # print(f"###############Failed to open audio file after {max_attempts} attempts.##############")
75
  # return # Terminate the function or raise an exception if the file could not be opened
76
 
 
 
 
 
 
 
77
  ###################Code to convert .wav to .mp3 (if neccesary)
78
  sf.write("Audio_Files/test.wav", audio_data, samplerate, subtype='PCM_16')
79
  sound = AudioSegment.from_wav("Audio_Files/test.wav")
 
133
  #gr.Audio(sources=["microphone"], type="filepath",format="wav"), #Gradio 4.x
134
  #gr.Audio(sources=["microphone"],type="numpy",editable="false"), #Gradio 4.x
135
  gr.Microphone(type="numpy"), #Gradio 4.x
136
+ gr.Radio(["Hallway Consult","Full Visit","Impression/Plan","Dx/DDx","Handover","Psych","Meds Only"], show_label=False),
137
  ]
138
 
139
  ui = gr.Interface(fn=transcribe,