tnt306 commited on
Commit
b0c89d5
·
1 Parent(s): f2ad242
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -39,8 +39,11 @@ import gradio as gr
39
  def predict():
40
  return {"Death": 0.9, "Alive": 0.1}
41
 
42
- def download_patient(patient_id: str):
43
- return f"Patient{patient_id}.csv"
 
 
 
44
 
45
  with gr.Blocks() as demo:
46
  with gr.Row():
@@ -54,10 +57,10 @@ with gr.Blocks() as demo:
54
  patient_1_download_btn = gr.DownloadButton(label="Download 1", value="1")
55
  with gr.Column(min_width=100):
56
  patient_2_input_btn = gr.Button("Patient 2")
57
- patient_2_download_btn = gr.DownloadButton("Download 2")
58
  with gr.Column(min_width=100):
59
  patient_3_input_btn = gr.Button("Patient 3")
60
- patient_3_download_btn = gr.DownloadButton("Download 3")
61
  with gr.Column():
62
  result = gr.Label(num_top_classes=2, label="Predictions")
63
 
 
39
  def predict():
40
  return {"Death": 0.9, "Alive": 0.1}
41
 
42
+ def download_patient(patient_id: str) -> str:
43
+ my_file = Path(f"Patient{patient_id}.csv")
44
+ if not my_file.is_file():
45
+ raise Exception(f"[{my_file}] not found.")
46
+ return str(my_file)
47
 
48
  with gr.Blocks() as demo:
49
  with gr.Row():
 
57
  patient_1_download_btn = gr.DownloadButton(label="Download 1", value="1")
58
  with gr.Column(min_width=100):
59
  patient_2_input_btn = gr.Button("Patient 2")
60
+ patient_2_download_btn = gr.DownloadButton(label="Download 2",value="2")
61
  with gr.Column(min_width=100):
62
  patient_3_input_btn = gr.Button("Patient 3")
63
+ patient_3_download_btn = gr.DownloadButton(label="Download 3", value="3")
64
  with gr.Column():
65
  result = gr.Label(num_top_classes=2, label="Predictions")
66