Spaces:
Sleeping
Sleeping
cleanup
Browse files- Untitled-1.py +0 -63
- app copy.py +0 -20
- app.py +2 -9
Untitled-1.py
DELETED
|
@@ -1,63 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
import gradio as gr
|
| 3 |
-
import time
|
| 4 |
-
|
| 5 |
-
disease_values = [0.25, 0.5, 0.75]
|
| 6 |
-
|
| 7 |
-
def xray_model(diseases, img):
|
| 8 |
-
return [{disease: disease_values[idx] for idx,disease in enumerate(diseases)}]
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
def ct_model(diseases, img):
|
| 12 |
-
return [{disease: 0.1 for disease in diseases}]
|
| 13 |
-
|
| 14 |
-
with gr.Blocks() as demo:
|
| 15 |
-
gr.Markdown(
|
| 16 |
-
"""
|
| 17 |
-
# Detect Disease From Scan
|
| 18 |
-
With this model you can lorem ipsum
|
| 19 |
-
- ipsum 1
|
| 20 |
-
- ipsum 2
|
| 21 |
-
"""
|
| 22 |
-
)
|
| 23 |
-
gr.DuplicateButton()
|
| 24 |
-
disease = gr.CheckboxGroup(
|
| 25 |
-
info="Select the diseases you want to scan for.",
|
| 26 |
-
choices=["Covid", "Malaria", "Lung Cancer"], label="Disease to Scan For"
|
| 27 |
-
)
|
| 28 |
-
slider = gr.Slider(0, 100)
|
| 29 |
-
|
| 30 |
-
with gr.Tab("X-ray") as x_tab:
|
| 31 |
-
with gr.Row():
|
| 32 |
-
xray_scan = gr.Image()
|
| 33 |
-
xray_results = gr.JSON()
|
| 34 |
-
xray_run = gr.Button("Run")
|
| 35 |
-
xray_run.click(
|
| 36 |
-
xray_model,
|
| 37 |
-
inputs=[disease, xray_scan],
|
| 38 |
-
outputs=xray_results,
|
| 39 |
-
api_name="xray_model"
|
| 40 |
-
)
|
| 41 |
-
|
| 42 |
-
with gr.Tab("CT Scan"):
|
| 43 |
-
with gr.Row():
|
| 44 |
-
ct_scan = gr.Image()
|
| 45 |
-
ct_results = gr.JSON()
|
| 46 |
-
ct_run = gr.Button("Run")
|
| 47 |
-
ct_run.click(
|
| 48 |
-
ct_model,
|
| 49 |
-
inputs=[disease, ct_scan],
|
| 50 |
-
outputs=ct_results,
|
| 51 |
-
api_name="ct_model"
|
| 52 |
-
)
|
| 53 |
-
|
| 54 |
-
upload_btn = gr.Button("Upload Results", variant="primary")
|
| 55 |
-
upload_btn.click(
|
| 56 |
-
lambda ct, xr: None,
|
| 57 |
-
inputs=[ct_results, xray_results],
|
| 58 |
-
outputs=[],
|
| 59 |
-
)
|
| 60 |
-
|
| 61 |
-
if __name__ == "__main__":
|
| 62 |
-
demo.launch()
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app copy.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
from gradio_client import Client
|
| 2 |
-
import gradio as gr
|
| 3 |
-
|
| 4 |
-
DEBUG_MODE = True
|
| 5 |
-
|
| 6 |
-
client = Client("Nuno-Tome/API_demo_server")
|
| 7 |
-
|
| 8 |
-
def request(text):
|
| 9 |
-
#if DEBUG_MODE:
|
| 10 |
-
result = "Hello World"
|
| 11 |
-
# gr.Markdown("client:" + str(client))
|
| 12 |
-
# gr.Markdown(f"## Requesting prediction for: {text}")
|
| 13 |
-
result = client.echo(text, api_name="/echo")
|
| 14 |
-
#if DEBUG_MODE:
|
| 15 |
-
# gr.Markdown(f"## Prediction result: {result}")
|
| 16 |
-
# print(f"Prediction result: {result}")
|
| 17 |
-
return result
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
io = gr.Interface(request, "textbox", "json")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -33,11 +33,6 @@ def get_bmc_markdown():
|
|
| 33 |
return full_text
|
| 34 |
|
| 35 |
|
| 36 |
-
|
| 37 |
-
def update(name):
|
| 38 |
-
#return f"Welcome to Gradio, {name}!"
|
| 39 |
-
return {"name": name}
|
| 40 |
-
|
| 41 |
def send_request(text):
|
| 42 |
client = Client("Nuno-Tome/API_demo_server")
|
| 43 |
result = client.predict(
|
|
@@ -50,7 +45,7 @@ with gr.Blocks() as demo:
|
|
| 50 |
|
| 51 |
gr.Markdown(MESAGE_HEADER)
|
| 52 |
gr.Markdown(get_bmc_markdown())
|
| 53 |
-
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column():
|
|
@@ -61,7 +56,5 @@ with gr.Blocks() as demo:
|
|
| 61 |
out = gr.JSON()
|
| 62 |
btn = gr.Button("Send request to server")
|
| 63 |
btn.click(fn=send_request, inputs=inp, outputs=out)
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
demo.launch(share=True)
|
|
|
|
| 33 |
return full_text
|
| 34 |
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
def send_request(text):
|
| 37 |
client = Client("Nuno-Tome/API_demo_server")
|
| 38 |
result = client.predict(
|
|
|
|
| 45 |
|
| 46 |
gr.Markdown(MESAGE_HEADER)
|
| 47 |
gr.Markdown(get_bmc_markdown())
|
| 48 |
+
gr.DuplicateButton()
|
| 49 |
|
| 50 |
with gr.Row():
|
| 51 |
with gr.Column():
|
|
|
|
| 56 |
out = gr.JSON()
|
| 57 |
btn = gr.Button("Send request to server")
|
| 58 |
btn.click(fn=send_request, inputs=inp, outputs=out)
|
| 59 |
+
|
|
|
|
|
|
|
| 60 |
demo.launch(share=True)
|