Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,29 +41,29 @@ def compute_pca(data):
|
|
41 |
|
42 |
def text_editor_app():
|
43 |
with gr.Blocks() as demo:
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
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 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
64 |
|
65 |
return demo
|
66 |
|
67 |
|
|
|
68 |
# Launch the app
|
69 |
text_editor_app().launch()
|
|
|
41 |
|
42 |
def text_editor_app():
|
43 |
with gr.Blocks() as demo:
|
44 |
+
identifiers = []
|
45 |
+
texts = []
|
46 |
+
with gr.Row():
|
47 |
+
for i in range(4): # Assuming 4 entries
|
48 |
+
with gr.Column():
|
49 |
+
id_input = gr.Textbox(label=f"Identifier {i+1}")
|
50 |
+
text_input = gr.Textbox(label=f"Text {i+1}")
|
51 |
+
identifiers.append(id_input)
|
52 |
+
texts.append(text_input)
|
53 |
|
|
|
54 |
analyze_button = gr.Button("Run Analysis")
|
|
|
|
|
55 |
output_plot = gr.Plot(label="PCA Visualization")
|
56 |
|
57 |
+
def collect_inputs(*args):
|
58 |
+
data = list(zip(args[:4], args[4:])) # Pair identifiers and texts
|
59 |
+
return compute_pca(data)
|
60 |
+
|
61 |
+
inputs = identifiers + texts
|
62 |
+
analyze_button.click(fn=collect_inputs, inputs=inputs, outputs=output_plot)
|
63 |
|
64 |
return demo
|
65 |
|
66 |
|
67 |
+
|
68 |
# Launch the app
|
69 |
text_editor_app().launch()
|