Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,13 @@ openai.api_key = os.environ["OPENAI_API_KEY"]
|
|
8 |
model = whisper.load_model("small")
|
9 |
|
10 |
|
|
|
11 |
def transcribe(audio):
|
12 |
model = whisper.load_model("base")
|
13 |
result = model.transcribe(audio)
|
14 |
return result["text"]
|
15 |
-
|
|
|
16 |
# def transcribe(audio):
|
17 |
|
18 |
# #time.sleep(3)
|
@@ -40,28 +42,10 @@ def process_text(input_text):
|
|
40 |
|
41 |
def get_completion(prompt, model='gpt-3.5-turbo'):
|
42 |
messages = [
|
43 |
-
{"role": "system", "content": """You are a
|
44 |
-
Extract the following information from the transcription, replace curly brackets with relevant extracted information
|
45 |
-
|
46 |
-
Demographic information: {name, age, gender, address, phone number}
|
47 |
-
|
48 |
-
Medical history: {chronic health conditions, any past surgery, any hospitalization, current medications}
|
49 |
-
|
50 |
-
Symptoms: {current symptoms, when did they start, how did they progress}
|
51 |
-
|
52 |
-
Allergies: {any known allergies, any allergic reaction to medications}
|
53 |
-
|
54 |
-
Family history: {any family members with chronic health condition, anyone in the family with a hereditary condition?}
|
55 |
-
|
56 |
-
Lifestyle factors: {typical diet, how often you exercise, smoking, drinking alcohol}
|
57 |
-
|
58 |
-
Psychosocial factors: {stress, anxiety, any mental health condition}
|
59 |
-
|
60 |
-
Review of systems: {any issues with vision or hearing, digestive issues, any problems with skin or nails, any problems with joints or muscles}
|
61 |
-
|
62 |
-
All information in the report needs to be in English only.
|
63 |
|
64 |
-
Only use the information from the provided transcription. Do not make up stuff. If information is not available just put "N/A" next to the relevant line.
|
65 |
"""
|
66 |
},
|
67 |
{"role": "user", "content": prompt}
|
@@ -77,16 +61,14 @@ def get_completion(prompt, model='gpt-3.5-turbo'):
|
|
77 |
with gr.Blocks() as demo:
|
78 |
|
79 |
gr.Markdown("""
|
80 |
-
#
|
|
|
|
|
81 |
|
82 |
-
This is to make life of non-English speaking patients easier.
|
83 |
-
Describe your complaints and symptoms in your native language , have it emailed to your doctor prior to your visit.
|
84 |
-
Information that is useful to include: your name, age, gender, address, phone number, medical history, symptoms, allergies, family medical history, lifestyle factors.
|
85 |
-
Have it all recorded, transcribed, and presented in a standard form.
|
86 |
""")
|
87 |
|
88 |
|
89 |
-
title = "
|
90 |
audio = gr.Audio(type="filepath")
|
91 |
|
92 |
b1 = gr.Button("Transcribe audio")
|
|
|
8 |
model = whisper.load_model("small")
|
9 |
|
10 |
|
11 |
+
#option 1
|
12 |
def transcribe(audio):
|
13 |
model = whisper.load_model("base")
|
14 |
result = model.transcribe(audio)
|
15 |
return result["text"]
|
16 |
+
|
17 |
+
#option 2
|
18 |
# def transcribe(audio):
|
19 |
|
20 |
# #time.sleep(3)
|
|
|
42 |
|
43 |
def get_completion(prompt, model='gpt-3.5-turbo'):
|
44 |
messages = [
|
45 |
+
{"role": "system", "content": """You are a .... You are provided with the transcription of a ... . \
|
46 |
+
Extract the following information from the transcription, replace curly brackets {} with relevant extracted information ... \
|
47 |
+
...the rest of your prompt...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
|
|
49 |
"""
|
50 |
},
|
51 |
{"role": "user", "content": prompt}
|
|
|
61 |
with gr.Blocks() as demo:
|
62 |
|
63 |
gr.Markdown("""
|
64 |
+
# Title <br>
|
65 |
+
|
66 |
+
Description
|
67 |
|
|
|
|
|
|
|
|
|
68 |
""")
|
69 |
|
70 |
|
71 |
+
title = "title"
|
72 |
audio = gr.Audio(type="filepath")
|
73 |
|
74 |
b1 = gr.Button("Transcribe audio")
|