Spaces:
Running
Running
create app
Browse files
app.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def nascet (X,Y):
|
4 |
+
result_nascet = ((Y-X)/Y)*100
|
5 |
+
return round (result_nascet,2)
|
6 |
+
|
7 |
+
def vertebral_height (A,B):
|
8 |
+
result_vertebral = ((B-A)/B)*100
|
9 |
+
return round (result_vertebral,2)
|
10 |
+
|
11 |
+
def volume (l,w,h):
|
12 |
+
result_volume = (l*w*h)/2
|
13 |
+
return round (result_volume,2)
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
# print (f'Stenosis per NASCET criteria is {nascet (X,Y)} percent ')
|
18 |
+
|
19 |
+
with gr.Blocks() as demo1:
|
20 |
+
X = gr.Number(label="Stenosis")
|
21 |
+
Y = gr.Number(label="Normal Diameter")
|
22 |
+
output = gr.Number(label="Stenosis per NASCET criteria is __ percent")
|
23 |
+
greet_btn = gr.Button("Calculate")
|
24 |
+
greet_btn.click(fn=nascet, inputs=[X,Y], outputs=output, api_name="nascet")
|
25 |
+
|
26 |
+
|
27 |
+
with gr.Blocks() as demo2:
|
28 |
+
A = gr.Number(label="Minimum height")
|
29 |
+
B = gr.Number(label="Normal heignt")
|
30 |
+
output1 = gr.Number(label="Vertebral height loss is __ percent")
|
31 |
+
greet_btn1 = gr.Button("Calculate")
|
32 |
+
greet_btn1.click(fn=vertebral_height, inputs=[A,B], outputs=output1, api_name="vertebral_height")
|
33 |
+
|
34 |
+
with gr.Blocks() as demo3:
|
35 |
+
l = gr.Number(label="length in cm")
|
36 |
+
w = gr.Number(label="width in cm")
|
37 |
+
h = gr.Number(label="height in cm")
|
38 |
+
output2 = gr.Number(label="The volume of the lesion is __ cc")
|
39 |
+
greet_btn2 = gr.Button("Calculate")
|
40 |
+
greet_btn2.click(fn=volume, inputs=[l,w,h], outputs=output2, api_name="volume")
|
41 |
+
|
42 |
+
|
43 |
+
demo = gr.TabbedInterface([demo1, demo2, demo3], ["NASCET CALCULATOR", "VERTEBRAL HEIGHT LOSS CALCULATOR", "VOLUME CALCULATOR"])
|
44 |
+
|
45 |
+
|
46 |
+
demo.launch()
|