Arthur-Attili commited on
Commit
9bf522d
·
verified ·
1 Parent(s): e638816

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +107 -1
app.py CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  # app.py OTIMIZADO
2
  import pandas as pd
3
  import requests
@@ -201,4 +207,104 @@ def get_administradoras_options():
201
  return sorted(adm_list)
202
  return []
203
 
204
- # O restante do código da interface Gradio permanece igual...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Imovel.ipynb
2
+ Automatically generated by Colab.
3
+ Original file is located at
4
+ https://colab.research.google.com/drive/1DZAQZfrXvTy358Vg2qfUg_ge6b3kcgBy
5
+ """
6
+
7
  # app.py OTIMIZADO
8
  import pandas as pd
9
  import requests
 
207
  return sorted(adm_list)
208
  return []
209
 
210
+ # Criando a interface Gradio
211
+ with gr.Blocks(title="Sistema de Busca de Consórcio Imóvel") as demo:
212
+ gr.HTML("""
213
+ <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
214
+ <style>
215
+ * {
216
+ font-family: 'Poppins', sans-serif !important;
217
+ }
218
+
219
+ body {
220
+ background-color: #ff8f00 !important;
221
+ color: black !important;
222
+ }
223
+
224
+ /* Inputs Numéricos: Crédito, Entrada, Parcela */
225
+ input[type="number"] {
226
+ background-color: white !important;
227
+ border: 2px solid #000 !important;
228
+ border-radius: 12px !important;
229
+ color: black !important;
230
+ padding: 10px !important;
231
+ font-weight: 500;
232
+ }
233
+
234
+ /* Inputs de texto e áreas de texto (como a saída e código) */
235
+ input[type="text"], textarea {
236
+ background-color: white !important;
237
+ border: 2px solid black !important;
238
+ border-radius: 12px !important;
239
+ color: black !important;
240
+ padding: 10px !important;
241
+ }
242
+
243
+ input::placeholder, textarea::placeholder {
244
+ color: #333 !important;
245
+ opacity: 0.7;
246
+ }
247
+
248
+ .gr-checkbox label {
249
+ display: flex;
250
+ align-items: center;
251
+ gap: 8px;
252
+ font-weight: 600;
253
+ }
254
+
255
+ input[type="checkbox"] {
256
+ accent-color: black !important;
257
+ width: 18px;
258
+ height: 18px;
259
+ }
260
+
261
+ .gr-button {
262
+ font-weight: bold;
263
+ border-radius: 10px !important;
264
+ background-color: white !important;
265
+ color: black !important;
266
+ border: 2px solid black !important;
267
+ }
268
+
269
+ .gr-button:hover {
270
+ background-color: #fff3e0 !important;
271
+ color: black !important;
272
+ }
273
+
274
+ label {
275
+ font-weight: 600 !important;
276
+ }
277
+ </style>
278
+ """)
279
+
280
+
281
+ gr.Markdown("# 🏠 Busca de Combinações de Consórcio Imóvel")
282
+ gr.Markdown("Insira os valores desejados para crédito, entrada e parcela, e filtre por administradora.")
283
+
284
+ with gr.Row():
285
+ credito_input = gr.Number(label="Crédito Desejado (R$)", value=300000, step=1000)
286
+ entrada_input = gr.Number(label="Entrada Desejada (R$)", value=30000, step=1000)
287
+ parcela_input = gr.Number(label="Parcela Desejada (R$)", value=1500, step=100)
288
+
289
+ administradoras_multiselect = gr.CheckboxGroup(
290
+ label="Filtrar por Administradoras",
291
+ choices=get_administradoras_options(),
292
+ value=get_administradoras_options() # Seleciona todas por padrão
293
+ )
294
+
295
+ submit_btn = gr.Button("🔍 Buscar Combinações", variant="primary")
296
+
297
+ output_text = gr.Textbox(label="Resultados da Busca", lines=20, max_lines=40, interactive=False, placeholder="Os resultados aparecerão aqui...")
298
+
299
+ submit_btn.click(
300
+ fn=ajustar_e_buscar,
301
+ inputs=[credito_input, entrada_input, parcela_input, administradoras_multiselect],
302
+ outputs=output_text
303
+ )
304
+
305
+ gr.Markdown("---")
306
+ gr.Markdown("Desenvolvido para auxiliar na busca por cotas de consórcio ideais.")
307
+
308
+ # Inicia o aplicativo Gradio
309
+ if __name__ == "__main__":
310
+ demo.launch() # Você não precisa disso no Colab, mas sim no arquivo que você fará o deploy