Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,33 +27,33 @@ def documentation():
|
|
| 27 |
Choose a model from the dropdown and enter text to see the sentiment prediction.
|
| 28 |
"""
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
)
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
| 27 |
Choose a model from the dropdown and enter text to see the sentiment prediction.
|
| 28 |
"""
|
| 29 |
|
| 30 |
+
with gr.Blocks(title="Sentiment Analysis", theme=gr.themes.Soft()) as demo:
|
| 31 |
+
with gr.Tabs():
|
| 32 |
+
with gr.TabItem("Demo"):
|
| 33 |
+
with gr.Row():
|
| 34 |
+
with gr.Column(scale=2):
|
| 35 |
+
text_input = gr.Textbox(label="Input Text", placeholder="Type here or select an example...")
|
| 36 |
+
model_choice = gr.Radio(["Model 1 (RoBERTa-large)", "Model 2 (BERTweet)"], label="Model Choice", value="Model 1 (RoBERTa-large)")
|
| 37 |
+
submit_button = gr.Button("Analyze")
|
| 38 |
+
with gr.Column():
|
| 39 |
+
output = gr.Label()
|
| 40 |
+
|
| 41 |
+
examples = gr.Examples(examples=[
|
| 42 |
+
"I absolutely love this product! It has changed my life.",
|
| 43 |
+
"This is the worst movie I have ever seen. Completely disappointing.",
|
| 44 |
+
"I'm not sure how I feel about this new update. It has some good points, but also many drawbacks.",
|
| 45 |
+
"The customer service was fantastic! Very helpful and polite.",
|
| 46 |
+
"Honestly, this was quite a mediocre experience. Nothing special."
|
| 47 |
+
], inputs=text_input)
|
| 48 |
+
|
| 49 |
+
submit_button.click(
|
| 50 |
+
predict_sentiment,
|
| 51 |
+
inputs=[text_input, model_choice],
|
| 52 |
+
outputs=output
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
with gr.TabItem("Documentation"):
|
| 56 |
+
doc_text = gr.Markdown()
|
| 57 |
+
doc_text.update(documentation())
|
| 58 |
+
|
| 59 |
+
demo.launch()
|