cha0smagick commited on
Commit
296c9ad
1 Parent(s): d99b766

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -1,8 +1,6 @@
1
  import streamlit as st
2
  from kerykeion import AstrologicalSubject, KerykeionChartSVG
3
  from kerykeion.report import Report
4
- import sys
5
- import huggingface_hub as hf
6
  import os
7
 
8
  def get_user_input():
@@ -45,29 +43,29 @@ def main():
45
  # Download the report as a text file
46
  st.markdown("## Descargar Informe")
47
  st.write("Haga clic en el bot贸n de abajo para descargar el informe en un archivo de texto.")
48
- output_path = hf.hf_get_output_path("informe.txt")
49
-
 
50
  if st.button("Descargar Informe"):
51
- with open(output_path, 'w') as file:
52
  sys.stdout = file
53
  user_report.print_report()
54
  sys.stdout = sys.__stdout__
55
- st.success(f"Informe descargado con 茅xito como '{output_path}'")
56
 
57
  # Display the content of 'informe.txt'
58
- with open(output_path, 'r') as file:
59
  report_content = file.read()
60
  st.markdown("## Contenido del Informe")
61
  st.text(report_content)
62
 
63
- # Search and display an SVG image using hf_get_output_path
64
  st.markdown("## Gr谩fico Astral Generado")
65
- current_directory = os.path.dirname(hf.hf_get_output_path(""))
66
- svg_files = [f for f in os.listdir(current_directory) if f.endswith(".svg")]
67
 
68
  if svg_files:
69
  svg_file = svg_files[0] # Display the first SVG file found
70
- st.image(os.path.join(current_directory, svg_file), use_container_width=True)
71
  else:
72
  st.write("No se encontraron archivos SVG en el directorio actual.")
73
 
 
1
  import streamlit as st
2
  from kerykeion import AstrologicalSubject, KerykeionChartSVG
3
  from kerykeion.report import Report
 
 
4
  import os
5
 
6
  def get_user_input():
 
43
  # Download the report as a text file
44
  st.markdown("## Descargar Informe")
45
  st.write("Haga clic en el bot贸n de abajo para descargar el informe en un archivo de texto.")
46
+
47
+ informe_file_path = os.path.join(st.hf_path, "informe.txt")
48
+
49
  if st.button("Descargar Informe"):
50
+ with open(informe_file_path, 'w') as file:
51
  sys.stdout = file
52
  user_report.print_report()
53
  sys.stdout = sys.__stdout__
54
+ st.success(f"Informe descargado con 茅xito como 'informe.txt'")
55
 
56
  # Display the content of 'informe.txt'
57
+ with open(informe_file_path, 'r') as file:
58
  report_content = file.read()
59
  st.markdown("## Contenido del Informe")
60
  st.text(report_content)
61
 
62
+ # Search and display an SVG image in the current directory
63
  st.markdown("## Gr谩fico Astral Generado")
64
+ svg_files = [f for f in os.listdir(st.hf_path) if f.endswith(".svg")]
 
65
 
66
  if svg_files:
67
  svg_file = svg_files[0] # Display the first SVG file found
68
+ st.image(os.path.join(st.hf_path, svg_file), use_container_width=True)
69
  else:
70
  st.write("No se encontraron archivos SVG en el directorio actual.")
71