tnt306's picture
Debug 12
31b3b1a
raw
history blame
2.39 kB
from typing import Dict
from pathlib import Path
import pandas as pd
from io import StringIO
import gradio as gr
# def predict(text: str) -> Dict:
# return {"alive": 0.9, "death": 0.1}
# example_list = [[1.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
# # Create title, description and article strings
# title = "This is title."
# description = "This is description."
# article = "This is article."
# default_csv = "Phase,Activity,Start date,End date\n\"Mapping the Field\",\"Literature review\",2024-01-01,2024-01-31"
# def process_csv_text(temp_file):
# if isinstance(temp_file, str):
# print("1")
# df = pd.read_csv(temp_file, header = "infer", sep = ",", encoding = "utf-8")
# else:
# print("2")
# df = pd.read_csv(temp_file.name)
# print("***")
# print(df)
# print("***")
# return df
# with gr.Blocks() as demo:
# upload_button = gr.UploadButton(label="Upload Timetable", file_types = ['.csv'], file_count = "single")
# table = gr.Dataframe(headers=["Phase", "Activity", "Start date", "End date"], type="pandas", col_count=4)
# upload_button.upload(fn=process_csv_text, inputs=upload_button, outputs=table, api_name="upload_csv")
# demo.launch(debug=True)
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
patient_upload_btn = gr.UploadButton(label="Upload A Patient",
file_types = ['.csv'],
file_count = "single")
with gr.Row():
# patient_1_input_btn = gr.Button("Patient 1")
# patient_1_download_btn = gr.DownloadButton("Download 1")
with gr.Column(min_width=100):
patient_1_input_btn = gr.Button("Patient 1")
patient_1_download_btn = gr.DownloadButton("Download 1")
with gr.Column(min_width=100):
patient_2_input_btn = gr.Button("Patient 2")
patient_2_download_btn = gr.DownloadButton("Download 2")
with gr.Column(min_width=100):
patient_3_input_btn = gr.Button("Patient 3")
patient_3_download_btn = gr.DownloadButton("Download 3")
with gr.Column():
btn1 = gr.Button("Will Display Output")
demo.launch(debug=True)