gloignon commited on
Commit
807ad31
·
verified ·
1 Parent(s): 7fc6901

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -41,25 +41,29 @@ def compute_pca(data):
41
 
42
  def text_editor_app():
43
  with gr.Blocks() as demo:
44
- # Use a DataFrame component for inputs
45
  data_input = gr.Dataframe(
46
  headers=["Identifier", "Text"],
47
  datatype=["str", "str"],
48
  row_count=(4, "dynamic"),
49
  col_count=(2, "fixed"),
50
- label="Input Data",
51
- wrap=True
 
 
52
  )
53
-
54
  # Button to run the analysis
55
  analyze_button = gr.Button("Run Analysis")
56
-
57
  # Output plot
58
  output_plot = gr.Plot(label="PCA Visualization")
59
-
60
  # Run analysis when the button is clicked
61
- analyze_button.click(fn=compute_pca, inputs=[data_input], outputs=output_plot)
62
-
 
 
63
  return demo
64
 
65
 
 
41
 
42
  def text_editor_app():
43
  with gr.Blocks() as demo:
44
+ # Use a DataFrame component for inputs with fixed columns
45
  data_input = gr.Dataframe(
46
  headers=["Identifier", "Text"],
47
  datatype=["str", "str"],
48
  row_count=(4, "dynamic"),
49
  col_count=(2, "fixed"),
50
+ label="Input Data (Enter at least two texts)",
51
+ wrap=True,
52
+ max_rows=10, # Optional: Limit the maximum number of rows
53
+ placeholder="Please enter at least two identifier-text pairs."
54
  )
55
+
56
  # Button to run the analysis
57
  analyze_button = gr.Button("Run Analysis")
58
+
59
  # Output plot
60
  output_plot = gr.Plot(label="PCA Visualization")
61
+
62
  # Run analysis when the button is clicked
63
+ analyze_button.click(
64
+ fn=compute_pca, inputs=data_input, outputs=output_plot
65
+ )
66
+
67
  return demo
68
 
69