Cosmographer commited on
Commit
f19eef2
Β·
verified Β·
1 Parent(s): 39c32e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -16
app.py CHANGED
@@ -843,6 +843,15 @@ css = """
843
  overflow-y: auto;
844
  }
845
 
 
 
 
 
 
 
 
 
 
846
  """
847
 
848
  vanta_html = """
@@ -924,11 +933,13 @@ with gr.Blocks(css=css, title="DataSynth β€” Analytics Hub") as demo:
924
  )
925
 
926
  with gr.TabItem("πŸ‘οΈ Data Preview"):
 
927
  sample_table = gr.Dataframe(
928
  interactive=False,
929
  label="Sample Data (First 100 rows)",
930
- height = 400
931
  )
 
932
 
933
  with gr.TabItem("πŸ“ˆ Visualizations"):
934
  gr.Markdown("### Correlation Analysis")
@@ -1019,24 +1030,24 @@ with gr.Blocks(css=css, title="DataSynth β€” Analytics Hub") as demo:
1019
  inputs=[upload],
1020
  outputs=[profile_md, sample_table, df_state, profile_state, corr_plot])
1021
 
1022
- def _view_data(uploaded):
1023
- try:
1024
- if uploaded is None:
1025
- return pd.DataFrame()
1026
- df = read_file_to_df(uploaded)
1027
- return df.head(100)
1028
- except Exception as e:
1029
- return pd.DataFrame()
1030
 
1031
- view_data_btn.click(fn=_view_data, inputs=[upload], outputs=[sample_table])
1032
 
1033
 
1034
  # download raw
1035
- def _download_raw(df_path):
1036
- if not df_path:
1037
- return None
1038
- return df_path
1039
- download_raw_btn.click(fn=_download_raw, inputs=[df_state], outputs=[download_raw_btn])
1040
 
1041
  # prepare: auto populate date and target choices when profile updated
1042
  def _populate_prepare(profile):
@@ -1188,7 +1199,7 @@ with gr.Blocks(css=css, title="DataSynth β€” Analytics Hub") as demo:
1188
  lines.append("# Executive Report β€” DataSynth")
1189
  lines.append("## Data Profile")
1190
  if profile:
1191
- lines.append(profile_to_markdown(profile))
1192
  else:
1193
  lines.append("No profile available.")
1194
  lines.append("\n## Preparation")
 
843
  overflow-y: auto;
844
  }
845
 
846
+ /* Dataframe container with fixed height */
847
+ .dataframe-container {
848
+ max-height: 500px;
849
+ overflow-y: auto;
850
+ border: 1px solid #ddd;
851
+ border-radius: 8px;
852
+ padding: 10px;
853
+ }
854
+
855
  """
856
 
857
  vanta_html = """
 
933
  )
934
 
935
  with gr.TabItem("πŸ‘οΈ Data Preview"):
936
+ gr.HTML("<div class='dataframe-container'>")
937
  sample_table = gr.Dataframe(
938
  interactive=False,
939
  label="Sample Data (First 100 rows)",
940
+ #height = 400
941
  )
942
+ gr.HTML("</div>")
943
 
944
  with gr.TabItem("πŸ“ˆ Visualizations"):
945
  gr.Markdown("### Correlation Analysis")
 
1030
  inputs=[upload],
1031
  outputs=[profile_md, sample_table, df_state, profile_state, corr_plot])
1032
 
1033
+ #def _view_data(uploaded):
1034
+ # try:
1035
+ # if uploaded is None:
1036
+ # return pd.DataFrame()
1037
+ # df = read_file_to_df(uploaded)
1038
+ # return df.head(100)
1039
+ #except Exception as e:
1040
+ # return pd.DataFrame()
1041
 
1042
+ #view_data_btn.click(fn=_view_data, inputs=[upload], outputs=[sample_table])
1043
 
1044
 
1045
  # download raw
1046
+ #def _download_raw(df_path):
1047
+ # if not df_path:
1048
+ # return None
1049
+ # return df_path
1050
+ #download_raw_btn.click(fn=_download_raw, inputs=[df_state], outputs=[download_raw_btn])
1051
 
1052
  # prepare: auto populate date and target choices when profile updated
1053
  def _populate_prepare(profile):
 
1199
  lines.append("# Executive Report β€” DataSynth")
1200
  lines.append("## Data Profile")
1201
  if profile:
1202
+ lines.append(profile_to_enhanced_markdown(profile))
1203
  else:
1204
  lines.append("No profile available.")
1205
  lines.append("\n## Preparation")