Persano commited on
Commit
cc97f27
verified
1 Parent(s): 0a7c294

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -88,23 +88,24 @@ iface = gr.Interface(
88
  description="Insira os valores abaixo e calcule o retorno sobre investimento (ROI) de aluguel."
89
  )
90
 
91
- # Adicionar bot茫o de "Gerar PDF"
92
- iface.add_component(
93
- gr.Button("Gerar PDF", variant="primary", elem_id="gerar_pdf_button"),
94
- inputs=[
 
 
 
 
 
 
95
  gr.Number(label="Valor do Im贸vel (R$)", value=500000),
96
  gr.Number(label="Investimento Pr贸prio (R$)", value=100000),
97
  gr.Number(label="Aluguel Mensal (R$)", value=2500),
98
  gr.Number(label="Tempo (anos)", value=20),
99
  gr.Number(label="Taxa de Juros (%)", value=8)
100
- ],
101
- outputs=[
102
- gr.File(label="Baixar PDF")
103
- ]
104
- )
105
 
106
  # Rodar a interface Gradio
107
  iface.launch(share=True)
108
 
109
 
110
-
 
88
  description="Insira os valores abaixo e calcule o retorno sobre investimento (ROI) de aluguel."
89
  )
90
 
91
+ # Criando o bot茫o para gerar o PDF
92
+ pdf_button = gr.Button("Gerar PDF", variant="primary")
93
+
94
+ # Fun莽茫o de callback para o bot茫o Gerar PDF
95
+ def on_pdf_button_click(valor_imovel, investimento_proprio, aluguel_mensal, tempo_anos, taxa_juros):
96
+ # Gerar PDF
97
+ return gerar_pdf_arquivo(valor_imovel, investimento_proprio, aluguel_mensal, tempo_anos, taxa_juros)
98
+
99
+ # Associando a fun莽茫o ao bot茫o Gerar PDF
100
+ pdf_button.click(on_pdf_button_click, inputs=[
101
  gr.Number(label="Valor do Im贸vel (R$)", value=500000),
102
  gr.Number(label="Investimento Pr贸prio (R$)", value=100000),
103
  gr.Number(label="Aluguel Mensal (R$)", value=2500),
104
  gr.Number(label="Tempo (anos)", value=20),
105
  gr.Number(label="Taxa de Juros (%)", value=8)
106
+ ], outputs=[gr.File(label="Baixar PDF")])
 
 
 
 
107
 
108
  # Rodar a interface Gradio
109
  iface.launch(share=True)
110
 
111