tnt306 commited on
Commit
06a1d7b
·
1 Parent(s): fb489b1
Files changed (1) hide show
  1. app.py +46 -26
app.py CHANGED
@@ -5,35 +5,55 @@ from io import StringIO
5
 
6
  import gradio as gr
7
 
8
-
9
  # def predict(text: str) -> Dict:
10
  # return {"alive": 0.9, "death": 0.1}
11
 
12
-
13
- example_list = [[1.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
14
-
15
- # Create title, description and article strings
16
- title = "This is title."
17
- description = "This is description."
18
- article = "This is article."
19
-
20
- default_csv = "Phase,Activity,Start date,End date\n\"Mapping the Field\",\"Literature review\",2024-01-01,2024-01-31"
21
-
22
- def process_csv_text(temp_file):
23
- if isinstance(temp_file, str):
24
- print("1")
25
- df = pd.read_csv(temp_file, header = "infer", sep = ",", encoding = "utf-8")
26
- else:
27
- print("2")
28
- df = pd.read_csv(temp_file.name)
29
- print("***")
30
- print(df)
31
- print("***")
32
- return df
 
 
 
 
 
 
33
 
34
  with gr.Blocks() as demo:
35
- upload_button = gr.UploadButton(label="Upload Timetable", file_types = ['.csv'], file_count = "single")
36
- table = gr.Dataframe(headers=["Phase", "Activity", "Start date", "End date"], type="pandas", col_count=4)
37
- upload_button.upload(fn=process_csv_text, inputs=upload_button, outputs=table, api_name="upload_csv")
38
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  demo.launch(debug=True)
 
5
 
6
  import gradio as gr
7
 
 
8
  # def predict(text: str) -> Dict:
9
  # return {"alive": 0.9, "death": 0.1}
10
 
11
+ # example_list = [[1.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
12
+
13
+ # # Create title, description and article strings
14
+ # title = "This is title."
15
+ # description = "This is description."
16
+ # article = "This is article."
17
+
18
+ # default_csv = "Phase,Activity,Start date,End date\n\"Mapping the Field\",\"Literature review\",2024-01-01,2024-01-31"
19
+
20
+ # def process_csv_text(temp_file):
21
+ # if isinstance(temp_file, str):
22
+ # print("1")
23
+ # df = pd.read_csv(temp_file, header = "infer", sep = ",", encoding = "utf-8")
24
+ # else:
25
+ # print("2")
26
+ # df = pd.read_csv(temp_file.name)
27
+ # print("***")
28
+ # print(df)
29
+ # print("***")
30
+ # return df
31
+
32
+ # with gr.Blocks() as demo:
33
+ # upload_button = gr.UploadButton(label="Upload Timetable", file_types = ['.csv'], file_count = "single")
34
+ # table = gr.Dataframe(headers=["Phase", "Activity", "Start date", "End date"], type="pandas", col_count=4)
35
+ # upload_button.upload(fn=process_csv_text, inputs=upload_button, outputs=table, api_name="upload_csv")
36
+
37
+ # demo.launch(debug=True)
38
 
39
  with gr.Blocks() as demo:
40
+ with gr.Row():
41
+ with gr.Column():
42
+ with gr.Row():
43
+ patient_upload_btn = gr.UploadButton(label="Upload A Patient",
44
+ file_types = ['.csv'],
45
+ file_count = "single")
46
+ with gr.Row():
47
+ with gr.Column():
48
+ patient_1_input_btn = gr.Button("Patient 1")
49
+ patient_1_download_btn = gr.DownloadButton("Download 1")
50
+ with gr.Column():
51
+ patient_2_input_btn = gr.Button("Patient 2")
52
+ patient_2_download_btn = gr.DownloadButton("Download 2")
53
+ with gr.Column():
54
+ patient_3_input_btn = gr.Button("Patient 3")
55
+ patient_3_download_btn = gr.DownloadButton("Download 3")
56
+ with gr.Column(scale=4):
57
+ btn1 = gr.Button("Button 1")
58
+
59
  demo.launch(debug=True)