Spaces:
Runtime error
Runtime error
Commit
路
c6be59e
1
Parent(s):
5e71c81
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from kerykeion import AstrologicalSubject, KerykeionChartSVG
|
3 |
+
from kerykeion.report import Report
|
4 |
+
from pathlib import Path
|
5 |
+
import sys
|
6 |
+
|
7 |
+
def get_user_input():
|
8 |
+
name = st.text_input("Nombre de la persona:")
|
9 |
+
year = st.number_input("A帽o de nacimiento:", min_value=1900, max_value=2099)
|
10 |
+
month = st.number_input("Mes de nacimiento (1-12):", min_value=1, max_value=12)
|
11 |
+
day = st.number_input("D铆a de nacimiento (1-31):", min_value=1, max_value=31)
|
12 |
+
hour = st.number_input("Hora de nacimiento (0-23):", min_value=0, max_value=23)
|
13 |
+
minute = st.number_input("Minuto de nacimiento (0-59):", min_value=0, max_value=59)
|
14 |
+
location = st.text_input("Lugar de nacimiento:")
|
15 |
+
zodiac_type = st.selectbox("Tipo de zodiaco", ["Tropic", "Sidereal"]).capitalize()
|
16 |
+
|
17 |
+
return name, year, month, day, hour, minute, location, zodiac_type
|
18 |
+
|
19 |
+
def main():
|
20 |
+
st.title("Generador de Cartas Astrales")
|
21 |
+
|
22 |
+
st.write("Ingrese la informaci贸n para la primera persona:")
|
23 |
+
name1, year1, month1, day1, hour1, minute1, location1, zodiac_type1 = get_user_input()
|
24 |
+
|
25 |
+
chart_type = st.selectbox("Tipo de gr谩fico", ["Natal", "Synastry", "Transit"]).capitalize()
|
26 |
+
|
27 |
+
if chart_type in ["Synastry", "Transit"]:
|
28 |
+
st.write("Ingrese la informaci贸n para la segunda persona:")
|
29 |
+
name2, year2, month2, day2, hour2, minute2, location2, zodiac_type2 = get_user_input()
|
30 |
+
person1 = AstrologicalSubject(name1, year1, month1, day1, hour1, minute1, location1, zodiac_type=zodiac_type1)
|
31 |
+
person2 = AstrologicalSubject(name2, year2, month2, day2, hour2, minute2, location2, zodiac_type=zodiac_type2)
|
32 |
+
name = KerykeionChartSVG(person1, chart_type=chart_type, second_obj=person2)
|
33 |
+
else:
|
34 |
+
person1 = AstrologicalSubject(name1, year1, month1, day1, hour1, minute1, location1, zodiac_type=zodiac_type1)
|
35 |
+
name = KerykeionChartSVG(person1, chart_type=chart_type)
|
36 |
+
|
37 |
+
name.makeSVG()
|
38 |
+
|
39 |
+
# Create a user report
|
40 |
+
user_report = Report(person1)
|
41 |
+
|
42 |
+
st.write(f"N煤mero de aspectos encontrados: {len(name.aspects_list)}")
|
43 |
+
|
44 |
+
# Download the report as a text file
|
45 |
+
st.markdown("## Descargar Informe")
|
46 |
+
st.write("Haga clic en el bot贸n de abajo para descargar el informe en un archivo de texto.")
|
47 |
+
|
48 |
+
if st.button("Descargar Informe"):
|
49 |
+
with open('informe.txt', 'w') as file:
|
50 |
+
sys.stdout = file
|
51 |
+
user_report.print_report()
|
52 |
+
sys.stdout = sys.__stdout__
|
53 |
+
st.success("Informe descargado con 茅xito como 'informe.txt'")
|
54 |
+
|
55 |
+
if __name__ == "__main__":
|
56 |
+
main()
|