Spaces:
Running
Running
refactor: json to markdown
Browse files
app.py
CHANGED
|
@@ -35,30 +35,29 @@ def get_alfred_from_dataframe(ecg_id):
|
|
| 35 |
|
| 36 |
|
| 37 |
with gr.Blocks() as demo:
|
| 38 |
-
with gr.
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
label="All PTB-XL v1.3.0 data (https://physionet.org/content/ptb-xl/1.0.3/ptbxl_database.csv). You can refer to the following URL(https://physionet.org/content/ptb-xl/1.0.3/scp_statements.csv) to understand what 'scp_codes' represent.",
|
| 45 |
-
)
|
| 46 |
-
|
| 47 |
-
with gr.Row():
|
| 48 |
-
ecg_id_output = gr.Textbox(label="The selected ecg_id is")
|
| 49 |
-
|
| 50 |
-
with gr.Row():
|
| 51 |
-
ecg_viewer = gr.Image(interactive=False, label="The selected ecg is")
|
| 52 |
-
|
| 53 |
-
with gr.Row():
|
| 54 |
-
alfred_result = gr.JSON(value={}, label="Alfred said that")
|
| 55 |
-
|
| 56 |
-
gr_df.select(fn=get_ecg_id_from_dataframe, inputs=gr_df, outputs=ecg_id_output)
|
| 57 |
-
ecg_id_output.change(
|
| 58 |
-
fn=get_ecg_image_from_dataframe, inputs=ecg_id_output, outputs=ecg_viewer
|
| 59 |
-
)
|
| 60 |
-
ecg_id_output.change(
|
| 61 |
-
fn=get_alfred_from_dataframe, inputs=ecg_id_output, outputs=alfred_result
|
| 62 |
)
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
demo.launch()
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
with gr.Blocks() as demo:
|
| 38 |
+
with gr.Row():
|
| 39 |
+
gr_df = gr.Dataframe(
|
| 40 |
+
value=ptbxl_df,
|
| 41 |
+
interactive=False,
|
| 42 |
+
max_height=200,
|
| 43 |
+
label="All PTB-XL v1.3.0 data (https://physionet.org/content/ptb-xl/1.0.3/ptbxl_database.csv). You can refer to the following URL(https://physionet.org/content/ptb-xl/1.0.3/scp_statements.csv) to understand what 'scp_codes' represent.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
)
|
| 45 |
|
| 46 |
+
with gr.Row():
|
| 47 |
+
ecg_id_output = gr.Textbox(label="The selected ecg_id is")
|
| 48 |
+
|
| 49 |
+
with gr.Row():
|
| 50 |
+
ecg_viewer = gr.Image(interactive=False, label="The selected ecg is")
|
| 51 |
+
|
| 52 |
+
with gr.Row():
|
| 53 |
+
alfred_result = gr.Markdown(value={}, label="Alfred said that")
|
| 54 |
+
|
| 55 |
+
gr_df.select(fn=get_ecg_id_from_dataframe, inputs=gr_df, outputs=ecg_id_output)
|
| 56 |
+
ecg_id_output.change(
|
| 57 |
+
fn=get_ecg_image_from_dataframe, inputs=ecg_id_output, outputs=ecg_viewer
|
| 58 |
+
)
|
| 59 |
+
ecg_id_output.change(
|
| 60 |
+
fn=get_alfred_from_dataframe, inputs=ecg_id_output, outputs=alfred_result
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
demo.launch()
|