Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import interface
|
3 |
-
import utils
|
4 |
-
import treegraph as tg
|
5 |
-
import os
|
6 |
-
|
7 |
-
user = os.environ.get("user")
|
8 |
-
passwd = os.environ.get("pass")
|
9 |
-
|
10 |
-
system_prompt = """
|
11 |
-
You are a critical AI radiology assistant.
|
12 |
-
You are helping a radiologist correctly fill out a radiology report.
|
13 |
-
The report is regarding a Knee MRI.
|
14 |
-
"""
|
15 |
-
|
16 |
-
graph, nodes_dict = tg.build_tree_from_file("knee_template.json")
|
17 |
-
report_interface = interface.ReportChecklistInterface(
|
18 |
-
llm=utils.LLM(model="gpt-3.5-turbo"),
|
19 |
-
system_prompt=system_prompt,
|
20 |
-
graph=graph,
|
21 |
-
nodes_dict=nodes_dict,
|
22 |
-
)
|
23 |
-
|
24 |
-
if report_interface.prime_model() is False:
|
25 |
-
print("Model priming failed. Please try again.")
|
26 |
-
exit()
|
27 |
-
else:
|
28 |
-
print("Model priming successful.")
|
29 |
-
|
30 |
-
|
31 |
-
def check_report(report):
|
32 |
-
results = report_interface.process_input(report)
|
33 |
-
if results == "quit":
|
34 |
-
quit_fn()
|
35 |
-
elif results == "help":
|
36 |
-
return report_interface.help_message
|
37 |
-
elif results == "exception":
|
38 |
-
return "An exception occurred. Please try again."
|
39 |
-
else:
|
40 |
-
return results
|
41 |
-
|
42 |
-
|
43 |
-
with gr.Blocks(theme="Taithrah/Minimal") as demo:
|
44 |
-
gr.Markdown("## Radiology Report Assistant")
|
45 |
-
gr.Markdown(report_interface.help_message)
|
46 |
-
|
47 |
-
report_textbox = gr.TextArea(label="Report", lines=20, max_lines=50)
|
48 |
-
check_btn = gr.Button(
|
49 |
-
value="Check Report",
|
50 |
-
)
|
51 |
-
clear_btn = gr.ClearButton(
|
52 |
-
value="Clear Messages",
|
53 |
-
)
|
54 |
-
|
55 |
-
results_textbox = gr.TextArea(label="Results", lines=20, max_lines=50)
|
56 |
-
clear_btn.add([results_textbox, report_textbox])
|
57 |
-
|
58 |
-
check_btn.click(fn=check_report, inputs=[report_textbox], outputs=[results_textbox])
|
59 |
-
|
60 |
-
demo.launch(auth=(user, passwd))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|