Spaces:
Runtime error
Runtime error
Commit
·
48400b1
1
Parent(s):
c87303d
Modf app
Browse files
app.py
CHANGED
|
@@ -25,12 +25,19 @@ df_reviews = load_reviews()
|
|
| 25 |
def show_sample():
|
| 26 |
return df_reviews.sample(5) # Muestra 5 filas aleatorias del DataFrame
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# Lanza la interfaz
|
| 36 |
if __name__ == "__main__":
|
|
|
|
| 25 |
def show_sample():
|
| 26 |
return df_reviews.sample(5) # Muestra 5 filas aleatorias del DataFrame
|
| 27 |
|
| 28 |
+
# Crear la interfaz usando gr.Blocks
|
| 29 |
+
with gr.Blocks() as demo:
|
| 30 |
+
with gr.Row():
|
| 31 |
+
with gr.Column():
|
| 32 |
+
input_review = gr.Textbox(lines=2, placeholder="Ingrese una reseña de Amazon Fashion aquí...")
|
| 33 |
+
label, score = gr.outputs.Label(), gr.outputs.Textbox()
|
| 34 |
+
submit_button = gr.Button("Analizar")
|
| 35 |
+
with gr.Column():
|
| 36 |
+
sample_button = gr.Button("Mostrar Ejemplos")
|
| 37 |
+
sample_df = gr.Dataframe()
|
| 38 |
+
|
| 39 |
+
submit_button.click(analyze_sentiment, inputs=input_review, outputs=[label, score])
|
| 40 |
+
sample_button.click(show_sample, inputs=None, outputs=sample_df)
|
| 41 |
|
| 42 |
# Lanza la interfaz
|
| 43 |
if __name__ == "__main__":
|