Spaces:
Running
Running
Update app.py
#8
by
fschwartzer
- opened
app.py
CHANGED
|
@@ -17,23 +17,34 @@ import ast
|
|
| 17 |
#-----------------#
|
| 18 |
|
| 19 |
#função para relatórios em pdf
|
| 20 |
-
def save_results_to_pdf(results_formatados, intervalo_confiança, valores_finais):
|
| 21 |
doc = SimpleDocTemplate("resultados.pdf", pagesize=letter)
|
| 22 |
styles = getSampleStyleSheet()
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
|
| 39 |
#-----------------#
|
|
@@ -903,7 +914,7 @@ def avaliacao_imovel(planilha, num_linhas_desejadas=3, finalidade='Defina o tipo
|
|
| 903 |
|
| 904 |
#-----------------#
|
| 905 |
|
| 906 |
-
save_results_to_pdf(resultados_formatados, intervalo_confiança, valores_finais)
|
| 907 |
result.to_excel(output_file, index=False)
|
| 908 |
|
| 909 |
#-----------------#
|
|
|
|
| 17 |
#-----------------#
|
| 18 |
|
| 19 |
#função para relatórios em pdf
|
| 20 |
+
def save_results_to_pdf(results_formatados, intervalo_confiança, valores_finais, image):
|
| 21 |
doc = SimpleDocTemplate("resultados.pdf", pagesize=letter)
|
| 22 |
styles = getSampleStyleSheet()
|
| 23 |
+
story = [
|
| 24 |
+
Image('avaliase.jpg', width=3.33 * inch, height=1.28 * inch),
|
| 25 |
+
Spacer(1, 36),
|
| 26 |
+
Paragraph('Relatório', styles['Heading1']),
|
| 27 |
+
Spacer(1, 36),
|
| 28 |
+
Paragraph('Resultados Estatísticos', styles['Heading2'])]
|
| 29 |
+
|
| 30 |
+
lines = results_formatados.splitlines()
|
| 31 |
+
# Create a paragraph for each line
|
| 32 |
+
for line in lines:
|
| 33 |
+
story.append(Paragraph(line, styles['Normal']))
|
| 34 |
+
story.append(Spacer(1, 36))
|
| 35 |
+
story.append(Paragraph('Intervalo de Confiança', styles['Heading2']))
|
| 36 |
+
lines = intervalo_confiança.splitlines()
|
| 37 |
+
for line in lines:
|
| 38 |
+
story.append(Paragraph(line, styles['Normal']))
|
| 39 |
+
story.append(Spacer(1, 36))
|
| 40 |
+
story.append(Paragraph('Valores Finais', styles['Heading2']))
|
| 41 |
+
lines = valores_finais.splitlines()
|
| 42 |
+
for line in lines:
|
| 43 |
+
story.append(Paragraph(line, styles['Normal']))
|
| 44 |
+
story.append(Spacer(1, 36))
|
| 45 |
+
story.append(Image('scatter_plot.png', width=4 * inch, height=4 * inch))
|
| 46 |
+
|
| 47 |
+
doc.build(story)
|
| 48 |
|
| 49 |
|
| 50 |
#-----------------#
|
|
|
|
| 914 |
|
| 915 |
#-----------------#
|
| 916 |
|
| 917 |
+
save_results_to_pdf(resultados_formatados, intervalo_confiança, valores_finais, 'scatter_plot.png')
|
| 918 |
result.to_excel(output_file, index=False)
|
| 919 |
|
| 920 |
#-----------------#
|