import gradio as gr def nascet (X,Y): result_nascet = ((Y-X)/Y)*100 return round (result_nascet,2) def vertebral_height (A,B): result_vertebral = ((B-A)/B)*100 return round (result_vertebral,2) def volume (l,w,h): result_volume = (l*w*h)/2 return round (result_volume,2) # print (f'Stenosis per NASCET criteria is {nascet (X,Y)} percent ') with gr.Blocks() as demo1: X = gr.Number(label="Stenosis") Y = gr.Number(label="Normal Diameter") output = gr.Number(label="Stenosis per NASCET criteria is __ percent") greet_btn = gr.Button("Calculate") greet_btn.click(fn=nascet, inputs=[X,Y], outputs=output, api_name="nascet") with gr.Blocks() as demo2: A = gr.Number(label="Minimum height") B = gr.Number(label="Normal heignt") output1 = gr.Number(label="Vertebral height loss is __ percent") greet_btn1 = gr.Button("Calculate") greet_btn1.click(fn=vertebral_height, inputs=[A,B], outputs=output1, api_name="vertebral_height") with gr.Blocks() as demo3: l = gr.Number(label="length in cm") w = gr.Number(label="width in cm") h = gr.Number(label="height in cm") output2 = gr.Number(label="The volume of the lesion is __ cc") greet_btn2 = gr.Button("Calculate") greet_btn2.click(fn=volume, inputs=[l,w,h], outputs=output2, api_name="volume") demo = gr.TabbedInterface([demo1, demo2, demo3], ["NASCET CALCULATOR", "VERTEBRAL HEIGHT LOSS CALCULATOR", "VOLUME CALCULATOR"]) demo.launch()