admin commited on
Commit
87c97f0
·
1 Parent(s): a8711f2
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -10,7 +10,6 @@ DATA_DIR = "./data"
10
 
11
  def list_to_csv(list_of_dicts: list, filename: str):
12
  keys = dict(list_of_dicts[0]).keys()
13
- # 将列表中的字典写入 CSV 文件
14
  with open(filename, "w", newline="", encoding="utf-8") as csvfile:
15
  writer = csv.DictWriter(csvfile, fieldnames=keys)
16
  writer.writeheader()
@@ -66,20 +65,20 @@ if __name__ == "__main__":
66
  fn=infer,
67
  inputs=[
68
  gr.Number(
69
- label="输入参与者数量 (Number of participants)",
70
  value=10,
71
  ),
72
  gr.Textbox(
73
- label="输入分组比率 (Grouping ratio)",
74
  value="8:1:1",
75
  show_copy_button=True,
76
  ),
77
  ],
78
  outputs=[
79
- gr.File(label="下载随机分组数据 CSV (Download data CSV)"),
80
- gr.Dataframe(label="随机分组数据预览 (Data preview)"),
81
  ],
82
- title="随机对照试验随机数生成器 (Randomized Controlled Trial Generator)",
83
- description="输入参与者数量和分组比率,格式为用:隔开的数字,生成随机分组数据。<br>Enter the number of participants and the grouping ratio in the format of numbers separated by : to generate randomized grouping data.",
84
  flagging_mode="never",
85
  ).launch()
 
10
 
11
  def list_to_csv(list_of_dicts: list, filename: str):
12
  keys = dict(list_of_dicts[0]).keys()
 
13
  with open(filename, "w", newline="", encoding="utf-8") as csvfile:
14
  writer = csv.DictWriter(csvfile, fieldnames=keys)
15
  writer.writeheader()
 
65
  fn=infer,
66
  inputs=[
67
  gr.Number(
68
+ label="Number of participants",
69
  value=10,
70
  ),
71
  gr.Textbox(
72
+ label="Grouping ratio",
73
  value="8:1:1",
74
  show_copy_button=True,
75
  ),
76
  ],
77
  outputs=[
78
+ gr.File(label="Download data CSV"),
79
+ gr.Dataframe(label="Data preview"),
80
  ],
81
+ title="Randomized Controlled Trial Generator",
82
+ description="Enter the number of participants and the grouping ratio in the format of numbers separated by : to generate randomized grouping data.",
83
  flagging_mode="never",
84
  ).launch()