atereoyinn
commited on
Commit
·
7370511
1
Parent(s):
c02053a
removed timeout and return the beam size to 5 and set up an enviroment vaiarable
Browse files
app.py
CHANGED
|
@@ -7,6 +7,11 @@ import csv
|
|
| 7 |
import json
|
| 8 |
import tempfile
|
| 9 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
# Initiate checkpoints for model loading
|
|
@@ -28,7 +33,7 @@ llama_tokenizer = AutoTokenizer.from_pretrained(llama_checkpoint)
|
|
| 28 |
# Function to transcribe audio
|
| 29 |
def transcribe_audio(audio_file_path):
|
| 30 |
try:
|
| 31 |
-
segments, info = whisper_model.transcribe(audio_file_path, beam_size=
|
| 32 |
text = "".join([segment.text for segment in segments])
|
| 33 |
return text
|
| 34 |
except Exception as e:
|
|
@@ -193,8 +198,7 @@ demo = gr.Interface(
|
|
| 193 |
gr.Textbox(label="Plan of Action"),
|
| 194 |
],
|
| 195 |
title="Medical Diagnostic Form Assistant",
|
| 196 |
-
description="Upload an audio file or record audio to generate a medical diagnostic form."
|
| 197 |
-
max_timeout=300
|
| 198 |
)
|
| 199 |
|
| 200 |
with demo:
|
|
|
|
| 7 |
import json
|
| 8 |
import tempfile
|
| 9 |
import torch
|
| 10 |
+
import os
|
| 11 |
+
|
| 12 |
+
# Set environment variables for gradio
|
| 13 |
+
os.environ["COMMANDLINE_ARGS"] = "--no-gradio-queue"
|
| 14 |
+
|
| 15 |
|
| 16 |
|
| 17 |
# Initiate checkpoints for model loading
|
|
|
|
| 33 |
# Function to transcribe audio
|
| 34 |
def transcribe_audio(audio_file_path):
|
| 35 |
try:
|
| 36 |
+
segments, info = whisper_model.transcribe(audio_file_path, beam_size=5)
|
| 37 |
text = "".join([segment.text for segment in segments])
|
| 38 |
return text
|
| 39 |
except Exception as e:
|
|
|
|
| 198 |
gr.Textbox(label="Plan of Action"),
|
| 199 |
],
|
| 200 |
title="Medical Diagnostic Form Assistant",
|
| 201 |
+
description="Upload an audio file or record audio to generate a medical diagnostic form."
|
|
|
|
| 202 |
)
|
| 203 |
|
| 204 |
with demo:
|