anonymous12321 commited on
Commit
9f44e15
·
verified ·
1 Parent(s): 1109ddb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -11
app.py CHANGED
@@ -2,7 +2,7 @@
2
  # -*- coding: utf-8 -*-
3
  """
4
  🪶 Council Matters Classifier – PT
5
- Dark modern Gradio interface with suggestions carousel.
6
  """
7
 
8
  import gradio as gr
@@ -170,7 +170,7 @@ def classify_display(text):
170
  chips += f"<span class='output-chip' style='border-color:{color}80;color:{color}'>{label} ({prob:.0%})</span>"
171
  return f"<div style='display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:10px'>{chips}</div>"
172
 
173
- # ---------------- CSS ----------------
174
  custom_css = """
175
  body { background-color: #0c0c0c; color: #f1f1f1; font-family: 'Inter', sans-serif; }
176
  .gradio-container { background-color: #0c0c0c; color: #f1f1f1; }
@@ -179,11 +179,32 @@ textarea { background-color: #181818 !important; color: #fff !important; border-
179
  button { background-color: #007aff !important; color: white !important; font-weight: 600 !important; border-radius: 8px !important; border: none !important; }
180
  button:hover { background-color: #00aaff !important; }
181
  .output-chip { background-color: #1a1a1a; padding: 5px 12px; border-radius: 8px; font-weight: 500; border: 1px solid #007aff33; }
182
- .suggestion-box { background-color: #111; border-radius: 10px; border: 1px solid #222; padding: 10px; display: flex; align-items: center; justify-content: space-between; color: #aaa; margin-top: 25px; }
183
- .arrow-btn { background: none; border: none; color: #00c3ff; font-size: 22px; cursor: pointer; }
184
- .arrow-btn:hover { color: #00e0ff; transform: scale(1.15); }
185
- .use-btn { background-color:#00c3ff !important; color:#000 !important; font-weight:600 !important; border-radius:6px !important; padding:3px 10px !important; }
186
- .use-btn:hover { background-color:#00e0ff !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  """
188
 
189
  # ---------------- Gradio UI ----------------
@@ -198,10 +219,10 @@ with gr.Blocks(css=custom_css, theme="gradio/soft") as demo:
198
  classify_btn.click(fn=classify_display, inputs=input_text, outputs=output)
199
 
200
  # Sugestões
201
- prev_btn = gr.Button("⟨")
202
- suggestion_display = gr.Textbox(value=suggestions[0], interactive=False)
203
- next_btn = gr.Button("⟩")
204
- use_btn = gr.Button("Usar sugestão")
205
 
206
  prev_btn.click(fn=prev_example, outputs=suggestion_display)
207
  next_btn.click(fn=next_example, outputs=suggestion_display)
@@ -209,5 +230,6 @@ with gr.Blocks(css=custom_css, theme="gradio/soft") as demo:
209
 
210
  gr.Row([prev_btn, suggestion_display, next_btn, use_btn], elem_id="suggestion-box")
211
 
 
212
  if __name__ == "__main__":
213
  demo.launch()
 
2
  # -*- coding: utf-8 -*-
3
  """
4
  🪶 Council Matters Classifier – PT
5
+ Dark modern Gradio interface with suggestions carousel and compact arrow buttons.
6
  """
7
 
8
  import gradio as gr
 
170
  chips += f"<span class='output-chip' style='border-color:{color}80;color:{color}'>{label} ({prob:.0%})</span>"
171
  return f"<div style='display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin-top:10px'>{chips}</div>"
172
 
173
+ # ---------------- CSS atualizado ----------------
174
  custom_css = """
175
  body { background-color: #0c0c0c; color: #f1f1f1; font-family: 'Inter', sans-serif; }
176
  .gradio-container { background-color: #0c0c0c; color: #f1f1f1; }
 
179
  button { background-color: #007aff !important; color: white !important; font-weight: 600 !important; border-radius: 8px !important; border: none !important; }
180
  button:hover { background-color: #00aaff !important; }
181
  .output-chip { background-color: #1a1a1a; padding: 5px 12px; border-radius: 8px; font-weight: 500; border: 1px solid #007aff33; }
182
+ .suggestion-box {
183
+ background-color: #112f50; /* azul mais suave */
184
+ border-radius: 10px;
185
+ border: 1px solid #1f3c5a;
186
+ padding: 10px;
187
+ display: flex;
188
+ align-items: center;
189
+ justify-content: center;
190
+ color: #eee;
191
+ margin-top: 25px;
192
+ position: relative;
193
+ }
194
+ .arrow-btn {
195
+ background: none;
196
+ border: none;
197
+ color: #e0f0ff;
198
+ font-size: 16px;
199
+ cursor: pointer;
200
+ font-weight: bold;
201
+ }
202
+ .arrow-btn:hover { color: #ffffff; transform: scale(1.2); }
203
+ .use-btn { background-color:#66b3ff !important; color:#000 !important; font-weight:600 !important; border-radius:6px !important; padding:3px 8px !important; margin-left:5px;}
204
+ .use-btn:hover { background-color:#99ccff !important; }
205
+ .suggestion-box .prev-btn { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); }
206
+ .suggestion-box .next-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
207
+ .suggestion-box .suggestion-text { width: 100%; text-align: center; padding: 0 40px; border:none; background:none; color:#eee; font-weight:500; }
208
  """
209
 
210
  # ---------------- Gradio UI ----------------
 
219
  classify_btn.click(fn=classify_display, inputs=input_text, outputs=output)
220
 
221
  # Sugestões
222
+ prev_btn = gr.Button("⟨", elem_classes="prev-btn arrow-btn")
223
+ suggestion_display = gr.Textbox(value=suggestions[0], interactive=False, elem_classes="suggestion-text")
224
+ next_btn = gr.Button("⟩", elem_classes="next-btn arrow-btn")
225
+ use_btn = gr.Button("Usar", elem_classes="use-btn")
226
 
227
  prev_btn.click(fn=prev_example, outputs=suggestion_display)
228
  next_btn.click(fn=next_example, outputs=suggestion_display)
 
230
 
231
  gr.Row([prev_btn, suggestion_display, next_btn, use_btn], elem_id="suggestion-box")
232
 
233
+ # ---------------- Launch ----------------
234
  if __name__ == "__main__":
235
  demo.launch()