| import gradio as gr | |
| #print ('Please select size of the tumor') | |
| #print ('Please write A if size of the lesion is less than 2 cm') | |
| #print ('Please write B if size of the lesion is more than than 2 but less than 4cm') | |
| #print ('Please write C if size of the lesion is more than 4 cm') | |
| def T_Staging (prompt): | |
| while True: | |
| ## without gradio, use this 'user_input = input (prompt)' | |
| user_input = prompt | |
| if user_input == 'A': | |
| return 'STAGING is T1' | |
| elif user_input =='B': | |
| return 'STAGING is T2' | |
| elif user_input =='C': | |
| return 'STAGING is T3' | |
| elif user_input == 'D': | |
| return 'STAGING is T4a' | |
| elif user_input == 'E': | |
| return 'STAGING is T4b' | |
| else: | |
| print("Please select A,B,C,D or E") | |
| # prompt = 'Please select A,B,C,D or E: ' | |
| #print ('Please write D if there is any involvement of larynx, extrinsic muscles of tongue, medial pterygoid, hard palate or mandible') | |
| #print ('Please write E if there is any involvement of lateral pterygoid, pterygoid plate, skull base, encasement of ICA or lateral nasopharynx') | |
| #print (T_Staging (prompt)) | |
| with gr.Blocks() as demo: | |
| gr.Markdown ('**Oropharynx Cancer Staging**') | |
| instruction = gr.TextArea (value= """Please write A if size of the lesion is less than 2 cm. | |
| Please write B if size of the lesion is more than than 2 but less than 4cm. | |
| Please write C if size of the lesion is more than 4 cm. | |
| Please write D if there is any involvement of larynx, extrinsic muscles of tongue, medial pterygoid, hard palate or mandible | |
| Please write E if there is any involvement of lateral pterygoid, pterygoid plate, skull base, encasement of ICA or lateral nasopharynx""", | |
| label = 'Instructions') | |
| # new= gr.Markdown ('**NEW**') | |
| prompt = gr.Radio (['A','B', 'C','D','E']) | |
| output = gr.Text(label="Staging is: ") | |
| greet_btn = gr.Button("Click here") | |
| greet_btn.click(fn=T_Staging, inputs=prompt, outputs=output, api_name="T_Staging") | |
| demo.launch() |