Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -251,9 +251,9 @@ def process_input(text_input, file):
|
|
| 251 |
results.append({
|
| 252 |
'Comment': comment,
|
| 253 |
'Dự đoán': label,
|
| 254 |
-
'
|
| 255 |
-
'
|
| 256 |
-
'
|
| 257 |
})
|
| 258 |
|
| 259 |
df2 = pd.DataFrame(results)
|
|
@@ -262,12 +262,12 @@ def process_input(text_input, file):
|
|
| 262 |
|
| 263 |
with gr.Blocks() as demo:
|
| 264 |
gr.Markdown("## Phân tích cảm xúc")
|
| 265 |
-
gr.Markdown("Nhập bình luận
|
| 266 |
text_input = gr.Textbox(lines=6, placeholder="Nhập bình luận tại đây...", label="")
|
| 267 |
gr.Markdown("Hoặc tải lên tệp .txt hoặc .csv chứa các bình luận:")
|
| 268 |
file_input = gr.File(label="Tải tệp", file_types=[".txt", ".csv"])
|
| 269 |
predict_button = gr.Button("Dự đoán")
|
| 270 |
-
output_table = gr.Dataframe(headers=["Comment", "Dự đoán", '
|
| 271 |
|
| 272 |
predict_button.click(
|
| 273 |
fn=process_input,
|
|
|
|
| 251 |
results.append({
|
| 252 |
'Comment': comment,
|
| 253 |
'Dự đoán': label,
|
| 254 |
+
'Khả năng tiêu cực': probability[0],
|
| 255 |
+
'Khả năng bình thường': probability[1],
|
| 256 |
+
'Khả năng tích cực': probability[2],
|
| 257 |
})
|
| 258 |
|
| 259 |
df2 = pd.DataFrame(results)
|
|
|
|
| 262 |
|
| 263 |
with gr.Blocks() as demo:
|
| 264 |
gr.Markdown("## Phân tích cảm xúc")
|
| 265 |
+
gr.Markdown("Nhập bình luận:")
|
| 266 |
text_input = gr.Textbox(lines=6, placeholder="Nhập bình luận tại đây...", label="")
|
| 267 |
gr.Markdown("Hoặc tải lên tệp .txt hoặc .csv chứa các bình luận:")
|
| 268 |
file_input = gr.File(label="Tải tệp", file_types=[".txt", ".csv"])
|
| 269 |
predict_button = gr.Button("Dự đoán")
|
| 270 |
+
output_table = gr.Dataframe(headers=["Comment", "Dự đoán", 'Khả năng tiêu cực', 'Khả năng bình thường', 'Khả năng tích cực'], interactive=False)
|
| 271 |
|
| 272 |
predict_button.click(
|
| 273 |
fn=process_input,
|