Spaces:
Runtime error
Runtime error
Commit
·
ae7aa65
1
Parent(s):
e3fce76
Update app.py
Browse files
app.py
CHANGED
@@ -95,7 +95,7 @@ def get_gpt_response(input_text):
|
|
95 |
return "No input provided.", "", "", "", ""
|
96 |
|
97 |
conversation = [
|
98 |
-
{"role": "system", "content": "You are an experienced medical consultant
|
99 |
{"role": "user", "content": input_text}
|
100 |
]
|
101 |
response = openai.ChatCompletion.create(
|
@@ -140,7 +140,7 @@ def chatbot(input_text, input_voice, patient_name=None):
|
|
140 |
# Get a response from GPT-3.5-turbo
|
141 |
gpt_subjective, gpt_objective, gpt_assessment, gpt_plan, gpt_general = get_gpt_response(input_text)
|
142 |
# Save GPT response to a file
|
143 |
-
gpt_file_path = os.path.join('SOAPWriterV01/GPTresponses', f"{patient_name}.txt")
|
144 |
with open(gpt_file_path, "a") as f:
|
145 |
f.write(f"Subjective: {gpt_subjective}\nObjective: {gpt_objective}\nAssessment: {gpt_assessment}\nPlan: {gpt_plan}\nGeneral: {gpt_general}\n\n")
|
146 |
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
@@ -149,7 +149,7 @@ def chatbot(input_text, input_voice, patient_name=None):
|
|
149 |
soap_response = response_index.response
|
150 |
|
151 |
patient_name = soap_response.split(' ')[1] if 'Subjective:' in soap_response else 'General'
|
152 |
-
patient_file_path = os.path.join('SOAPWriterV01/Docs', f"{patient_name}.txt")
|
153 |
|
154 |
if all(keyword.lower() in soap_response.lower() for keyword in ["subjective:", "objective:", "assessment:", "plan:"]):
|
155 |
s_index = soap_response.lower().find('subjective:')
|
@@ -196,7 +196,7 @@ interface = Interface(
|
|
196 |
)
|
197 |
|
198 |
|
199 |
-
index = construct_index('SOAPWriterV01/Docs')
|
200 |
interface.launch()
|
201 |
|
202 |
|
|
|
95 |
return "No input provided.", "", "", "", ""
|
96 |
|
97 |
conversation = [
|
98 |
+
{"role": "system", "content": "You are an experienced medical consultant who provides a SOAP note based on the information in the input provided."},
|
99 |
{"role": "user", "content": input_text}
|
100 |
]
|
101 |
response = openai.ChatCompletion.create(
|
|
|
140 |
# Get a response from GPT-3.5-turbo
|
141 |
gpt_subjective, gpt_objective, gpt_assessment, gpt_plan, gpt_general = get_gpt_response(input_text)
|
142 |
# Save GPT response to a file
|
143 |
+
gpt_file_path = os.path.join('/app/home/user/app/SOAPWriterV01/GPTresponses', f"{patient_name}.txt")
|
144 |
with open(gpt_file_path, "a") as f:
|
145 |
f.write(f"Subjective: {gpt_subjective}\nObjective: {gpt_objective}\nAssessment: {gpt_assessment}\nPlan: {gpt_plan}\nGeneral: {gpt_general}\n\n")
|
146 |
index = GPTSimpleVectorIndex.load_from_disk('index.json')
|
|
|
149 |
soap_response = response_index.response
|
150 |
|
151 |
patient_name = soap_response.split(' ')[1] if 'Subjective:' in soap_response else 'General'
|
152 |
+
patient_file_path = os.path.join('/app/home/user/app/SOAPWriterV01/Docs', f"{patient_name}.txt")
|
153 |
|
154 |
if all(keyword.lower() in soap_response.lower() for keyword in ["subjective:", "objective:", "assessment:", "plan:"]):
|
155 |
s_index = soap_response.lower().find('subjective:')
|
|
|
196 |
)
|
197 |
|
198 |
|
199 |
+
index = construct_index('/app/home/user/app/SOAPWriterV01/Docs')
|
200 |
interface.launch()
|
201 |
|
202 |
|