cptcrk commited on
Commit
68d5086
Β·
verified Β·
1 Parent(s): df5bddb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -17
app.py CHANGED
@@ -65,17 +65,21 @@ def analyze_multilingual_sentences(text):
65
 
66
  return output, fig
67
 
68
- # Lijst met extra voorbeeldzinnen
69
- example_sentences = [
70
- "I just aced my exam.",
71
- "My cat knocked over my coffee.",
72
- "Pineapple on pizza is the best debate of our generation.",
73
- "Woke up feeling like the main character.",
74
- "Spilled my cereal and questioned my life choices.",
75
- "This app better not judge me.",
76
- "I forgot my homework and now I'm panicking.",
77
- "This song makes me feel amazing.",
78
- "My internet just crashed, life is over."
 
 
 
 
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("Analyze Sentiment")
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 example_sentences:
112
  gr.Button(example).click(fill_example, inputs=[], outputs=input_box, queue=False)
113
 
114
- # Start de app
115
- demo.launch()
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)