Spaces:
Runtime error
Runtime error
Commit
路
397e334
1
Parent(s):
9adf504
Enhancing the interface
Browse files
app.py
CHANGED
@@ -69,22 +69,23 @@ def show_first_five(category):
|
|
69 |
return df_category.head(5) # Muestra las primeras 5 filas del DataFrame de la categor铆a
|
70 |
|
71 |
# Crear la interfaz usando gr.Blocks
|
72 |
-
with gr.Blocks() as demo:
|
|
|
73 |
gr.Markdown(
|
74 |
'''
|
75 |
-
<h1 style='text-align: center; color: navy;'>An谩lisis de Sentimientos Amazon</h1>
|
76 |
<p style='text-align: center;'>Seleccione una categor铆a y visualice los datos y la distribuci贸n de sentimientos.</p>
|
77 |
'''
|
78 |
)
|
79 |
-
with gr.
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
|
89 |
show_button.click(show_first_five, inputs=category, outputs=output_df)
|
90 |
plot_button.click(sentiment_counts_by_category, inputs=category, outputs=[output_bar_plot, output_pie_plot])
|
|
|
69 |
return df_category.head(5) # Muestra las primeras 5 filas del DataFrame de la categor铆a
|
70 |
|
71 |
# Crear la interfaz usando gr.Blocks
|
72 |
+
with gr.Blocks(css='style.css') as demo:
|
73 |
+
gr.Markdown("<font color=red size=10><center>Sentiment analysis: Amazon </center></font>")
|
74 |
gr.Markdown(
|
75 |
'''
|
|
|
76 |
<p style='text-align: center;'>Seleccione una categor铆a y visualice los datos y la distribuci贸n de sentimientos.</p>
|
77 |
'''
|
78 |
)
|
79 |
+
with gr.Column():
|
80 |
+
with gr.Row():
|
81 |
+
with gr.Column():
|
82 |
+
category = gr.Dropdown(choices=list(category_to_file_path.keys()), label="Seleccione una categor铆a")
|
83 |
+
show_button = gr.Button("Mostrar Datos")
|
84 |
+
plot_button = gr.Button("Graficar Distribuci贸n de Sentimientos")
|
85 |
+
with gr.Column():
|
86 |
+
output_df = gr.Dataframe()
|
87 |
+
output_bar_plot = gr.Plot()
|
88 |
+
output_pie_plot = gr.Plot()
|
89 |
|
90 |
show_button.click(show_first_five, inputs=category, outputs=output_df)
|
91 |
plot_button.click(sentiment_counts_by_category, inputs=category, outputs=[output_bar_plot, output_pie_plot])
|