Spaces:
Sleeping
Sleeping
UI Gradio
Browse files
app.py
CHANGED
@@ -96,11 +96,19 @@ def predict_sentiment(text):
|
|
96 |
return "An error occurred while processing your request."
|
97 |
|
98 |
# Membangun antarmuka Gradio
|
99 |
-
iface = gr.Interface(
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
# Menjalankan antarmuka
|
106 |
iface.launch(debug=True)
|
|
|
96 |
return "An error occurred while processing your request."
|
97 |
|
98 |
# Membangun antarmuka Gradio
|
99 |
+
iface = gr.Interface(
|
100 |
+
fn=predict_sentiment,
|
101 |
+
inputs=gr.inputs.Textbox(lines=5, placeholder="Enter your text here..."),
|
102 |
+
outputs="text", # Change output to text to display error messages if any
|
103 |
+
title="Sentiment Analysis of Amazon Products",
|
104 |
+
description="Enter text to predict sentiment (positive/neutral/negative)",
|
105 |
+
examples=[
|
106 |
+
["This product is amazing and I am very satisfied with its quality."],
|
107 |
+
["I do not like this product, it is very disappointing."],
|
108 |
+
["This product is okay, but it could be better."]
|
109 |
+
],
|
110 |
+
theme="default",
|
111 |
+
css=".output-text { font-size: 20px; color: #333; } .input-text { font-size: 18px; } .gradio-container { background-color: #f9f9f9; padding: 20px; border-radius: 10px; }",
|
112 |
+
)
|
113 |
# Menjalankan antarmuka
|
114 |
iface.launch(debug=True)
|