renaldidafa commited on
Commit
dff5c95
·
verified ·
1 Parent(s): f8277e1
Files changed (1) hide show
  1. app.py +14 -6
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(fn=predict_sentiment,
100
- inputs="text",
101
- outputs="text", # Mengubah output menjadi text untuk menampilkan pesan error jika ada
102
- title="Sentiment Analysis Product Amazon",
103
- description="Masukkan teks untuk memprediksi sentimen (positif/neutral/negatif)")
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)