Update app.py
Browse files
app.py
CHANGED
@@ -31,8 +31,6 @@
|
|
31 |
# # Launch the interface
|
32 |
# interface.launch()
|
33 |
|
34 |
-
|
35 |
-
|
36 |
import gradio as gr
|
37 |
from transformers import RobertaForSequenceClassification, RobertaTokenizer
|
38 |
import torch
|
@@ -74,18 +72,17 @@ css = """
|
|
74 |
"""
|
75 |
|
76 |
# Create a Gradio interface
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
)
|
88 |
|
|
|
89 |
|
90 |
-
|
91 |
-
interface.launch()
|
|
|
31 |
# # Launch the interface
|
32 |
# interface.launch()
|
33 |
|
|
|
|
|
34 |
import gradio as gr
|
35 |
from transformers import RobertaForSequenceClassification, RobertaTokenizer
|
36 |
import torch
|
|
|
72 |
"""
|
73 |
|
74 |
# Create a Gradio interface
|
75 |
+
with gr.Blocks(css=css) as demo:
|
76 |
+
gr.Markdown("# Sentiment Analysis with RoBERTa")
|
77 |
+
gr.Markdown("Analyze the sentiment of Amazon reviews using a fine-tuned RoBERTa model. Enter a review to see if it is positive or negative. **LABEL_1 = Positive** and **LABEL_0 = Negative**.")
|
78 |
+
|
79 |
+
with gr.Row():
|
80 |
+
with gr.Column():
|
81 |
+
input_text = gr.Textbox(lines=5, placeholder="Enter a review...", label="Review Text")
|
82 |
+
submit_btn = gr.Button("Analyze")
|
83 |
+
with gr.Column():
|
84 |
+
output_text = gr.Textbox(label="Sentiment")
|
|
|
85 |
|
86 |
+
submit_btn.click(predict_sentiment, inputs=input_text, outputs=output_text)
|
87 |
|
88 |
+
demo.launch()
|
|