andymbryant commited on
Commit
8a2c637
·
1 Parent(s): cbbf201

cleaning up text

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -8,12 +8,11 @@ def export_csv(d):
8
  d.to_csv(filepath)
9
  return gr.File.update(value=filepath, visible=True)
10
 
11
-
12
- def generate_step_markdown(step_number: int, subtitle: str):
13
- return gr.Markdown(f"# Step {step_number}\n\n ### {subtitle}")
14
 
15
  def export_csv(df, filename):
16
- df.to_csv(filename)
17
  return gr.File.update(value=filename, visible=True)
18
 
19
  def export_text(val, filename):
@@ -40,7 +39,7 @@ with gr.Blocks() as demo:
40
  upload_source_button.upload(fn=process_csv_text, inputs=upload_source_button, outputs=source_df)
41
 
42
  # STEP 2
43
- generate_step_markdown(2, "Generate mapping from Source to Template. Once generated, you can edit the values directly in the table below.")
44
  with gr.Row():
45
  generate_mapping_btn = gr.Button(value="Generate Mapping", variant="primary")
46
  with gr.Row():
@@ -56,7 +55,7 @@ with gr.Blocks() as demo:
56
  mapping_file.change(lambda x: x, mapping_file, table_mapping_df)
57
 
58
  # STEP 3
59
- generate_step_markdown(3, "Generate python code to transform Source to Template, using the generated mapping.")
60
  with gr.Row():
61
  generate_code_btn = gr.Button(value="Generate Code from Mapping", variant="primary")
62
  with gr.Row():
@@ -72,7 +71,7 @@ with gr.Blocks() as demo:
72
  code_file.change(lambda x: x, code_file, code_block)
73
 
74
  # STEP 4
75
- generate_step_markdown(4, "Transform the Source CSV into the Template CSV using the generated code.")
76
  with gr.Row():
77
  transform_btn = gr.Button(value="Transform Source", variant="primary")
78
  with gr.Row():
 
8
  d.to_csv(filepath)
9
  return gr.File.update(value=filepath, visible=True)
10
 
11
+ def generate_step_markdown(step_number: int, subtitle: str, description: str = None):
12
+ return gr.Markdown(f"# Step {step_number}\n\n ### {subtitle}\n{description}")
 
13
 
14
  def export_csv(df, filename):
15
+ df.to_csv(filename, index=False)
16
  return gr.File.update(value=filename, visible=True)
17
 
18
  def export_text(val, filename):
 
39
  upload_source_button.upload(fn=process_csv_text, inputs=upload_source_button, outputs=source_df)
40
 
41
  # STEP 2
42
+ generate_step_markdown(2, "Generate mapping from Source to Template.", "Once generated, you can edit the values directly in the table below and they will be incorporated into the mapping logic.")
43
  with gr.Row():
44
  generate_mapping_btn = gr.Button(value="Generate Mapping", variant="primary")
45
  with gr.Row():
 
55
  mapping_file.change(lambda x: x, mapping_file, table_mapping_df)
56
 
57
  # STEP 3
58
+ generate_step_markdown(3, "Generate python code to transform Source to Template, using the generated mapping.", "Once generated, you can edit the code directly in the code block below and it will be incorporated into the transformation logic. And this is re-runnable! Update the mapping logic above to try it out.")
59
  with gr.Row():
60
  generate_code_btn = gr.Button(value="Generate Code from Mapping", variant="primary")
61
  with gr.Row():
 
71
  code_file.change(lambda x: x, code_file, code_block)
72
 
73
  # STEP 4
74
+ generate_step_markdown(4, "Transform the Source CSV into the Template CSV using the generated code.", "And this is re-runnable! Update the logic above to try it out.")
75
  with gr.Row():
76
  transform_btn = gr.Button(value="Transform Source", variant="primary")
77
  with gr.Row():