Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,17 +65,21 @@ def analyze_multilingual_sentences(text):
|
|
| 65 |
|
| 66 |
return output, fig
|
| 67 |
|
| 68 |
-
#
|
| 69 |
-
|
| 70 |
-
"I just
|
| 71 |
-
"My
|
| 72 |
-
"
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
"
|
| 78 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
]
|
| 80 |
|
| 81 |
# Functie om voorbeeldzinnen in het invoerveld te zetten
|
|
@@ -93,6 +97,12 @@ with gr.Blocks() as demo:
|
|
| 93 |
"""
|
| 94 |
)
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
input_box = gr.Textbox(
|
| 97 |
lines=5,
|
| 98 |
placeholder="Hey there! Drop some sentences (one per line) and get instant sentiment vibesβpositive, neutral, or negative...",
|
|
@@ -102,16 +112,26 @@ with gr.Blocks() as demo:
|
|
| 102 |
output_box = gr.HTML(label="Results")
|
| 103 |
plot_box = gr.Plot(label="Sentiment Distribution")
|
| 104 |
|
| 105 |
-
analyze_button = gr.Button("
|
| 106 |
analyze_button.click(analyze_multilingual_sentences, inputs=input_box, outputs=[output_box, plot_box])
|
| 107 |
|
| 108 |
gr.Markdown("<h3>π‘ Try More Sentences:</h3>")
|
| 109 |
|
| 110 |
with gr.Row():
|
| 111 |
-
for example in
|
| 112 |
gr.Button(example).click(fill_example, inputs=[], outputs=input_box, queue=False)
|
| 113 |
|
| 114 |
-
#
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
return output, fig
|
| 67 |
|
| 68 |
+
# Voorbeeldzinnen bovenaan
|
| 69 |
+
example_sentences_top = [
|
| 70 |
+
"I just won the lottery!",
|
| 71 |
+
"My phone battery died in the middle of an important call.",
|
| 72 |
+
"This weather is so boring."
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
# Extra voorbeeldzinnen onderaan
|
| 76 |
+
example_sentences_bottom = [
|
| 77 |
+
"I woke up at 5 AM and went for a run.",
|
| 78 |
+
"This is the worst movie I have ever seen.",
|
| 79 |
+
"Just got a puppy, and I'm in love!",
|
| 80 |
+
"The internet is so slow today.",
|
| 81 |
+
"I spilled coffee on my laptop, disaster!",
|
| 82 |
+
"I finally finished my project, time to celebrate!"
|
| 83 |
]
|
| 84 |
|
| 85 |
# Functie om voorbeeldzinnen in het invoerveld te zetten
|
|
|
|
| 97 |
"""
|
| 98 |
)
|
| 99 |
|
| 100 |
+
# Voorbeeldzinnen bovenaan
|
| 101 |
+
gr.Markdown("<h3>π‘ Try These Sentences:</h3>")
|
| 102 |
+
with gr.Row():
|
| 103 |
+
for example in example_sentences_top:
|
| 104 |
+
gr.Button(example).click(fill_example, inputs=[], outputs=gr.Textbox(), queue=False)
|
| 105 |
+
|
| 106 |
input_box = gr.Textbox(
|
| 107 |
lines=5,
|
| 108 |
placeholder="Hey there! Drop some sentences (one per line) and get instant sentiment vibesβpositive, neutral, or negative...",
|
|
|
|
| 112 |
output_box = gr.HTML(label="Results")
|
| 113 |
plot_box = gr.Plot(label="Sentiment Distribution")
|
| 114 |
|
| 115 |
+
analyze_button = gr.Button("Tell me how I feel", elem_id="analyze-btn")
|
| 116 |
analyze_button.click(analyze_multilingual_sentences, inputs=input_box, outputs=[output_box, plot_box])
|
| 117 |
|
| 118 |
gr.Markdown("<h3>π‘ Try More Sentences:</h3>")
|
| 119 |
|
| 120 |
with gr.Row():
|
| 121 |
+
for example in example_sentences_bottom:
|
| 122 |
gr.Button(example).click(fill_example, inputs=[], outputs=input_box, queue=False)
|
| 123 |
|
| 124 |
+
# CSS voor styling (lichtgroene knop)
|
| 125 |
+
css = """
|
| 126 |
+
#analyze-btn {
|
| 127 |
+
background-color: #90EE90 !important;
|
| 128 |
+
color: black !important;
|
| 129 |
+
font-weight: bold;
|
| 130 |
+
font-size: 16px;
|
| 131 |
+
padding: 10px 20px;
|
| 132 |
+
border-radius: 8px;
|
| 133 |
+
}
|
| 134 |
+
"""
|
| 135 |
+
|
| 136 |
+
# Start de app met extra CSS-styling
|
| 137 |
+
demo.launch(share=True, css=css)
|