Spaces:
Sleeping
Sleeping
refactor: polish about response of llm
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
|
|
3 |
import pandas as pd
|
4 |
import requests
|
5 |
from matplotlib.image import imread
|
|
|
6 |
|
7 |
|
8 |
ALFRED_URL = "http://106.254.240.186:30007"
|
@@ -18,8 +19,7 @@ def get_ecg_id_from_dataframe(df: pd.DataFrame, evt: gr.SelectData):
|
|
18 |
|
19 |
def get_ecg_image_from_dataframe(ecg_id):
|
20 |
response = requests.post(
|
21 |
-
f"{ALFRED_URL}/hf_demo/ptbxl_to_image",
|
22 |
-
params={"ecg_id": ecg_id},
|
23 |
)
|
24 |
response.raise_for_status()
|
25 |
return imread(BytesIO(response.content))
|
@@ -27,11 +27,11 @@ def get_ecg_image_from_dataframe(ecg_id):
|
|
27 |
|
28 |
def get_alfred_from_dataframe(ecg_id):
|
29 |
response = requests.post(
|
30 |
-
f"{ALFRED_URL}/hf_demo/alfred",
|
31 |
-
params={"ecg_id": ecg_id},
|
32 |
)
|
33 |
response.raise_for_status()
|
34 |
-
|
|
|
35 |
|
36 |
|
37 |
with gr.Blocks() as demo:
|
|
|
3 |
import pandas as pd
|
4 |
import requests
|
5 |
from matplotlib.image import imread
|
6 |
+
from ast import literal_eval
|
7 |
|
8 |
|
9 |
ALFRED_URL = "http://106.254.240.186:30007"
|
|
|
19 |
|
20 |
def get_ecg_image_from_dataframe(ecg_id):
|
21 |
response = requests.post(
|
22 |
+
f"{ALFRED_URL}/hf_demo/ptbxl_to_image", params={"ecg_id": ecg_id}, timeout=600
|
|
|
23 |
)
|
24 |
response.raise_for_status()
|
25 |
return imread(BytesIO(response.content))
|
|
|
27 |
|
28 |
def get_alfred_from_dataframe(ecg_id):
|
29 |
response = requests.post(
|
30 |
+
f"{ALFRED_URL}/hf_demo/alfred", params={"ecg_id": ecg_id}, timeout=600
|
|
|
31 |
)
|
32 |
response.raise_for_status()
|
33 |
+
|
34 |
+
return literal_eval(response.text)
|
35 |
|
36 |
|
37 |
with gr.Blocks() as demo:
|