Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# app.py
|
| 2 |
"""
|
| 3 |
Streamlined Streamlit application for AI Astrology app with automatic timezone detection.
|
| 4 |
"""
|
|
@@ -12,7 +11,7 @@ from dotenv import load_dotenv
|
|
| 12 |
from astro_core import ChartCalculator # Assuming you have the astro_core.py file
|
| 13 |
from ai_interpreter import AstroAI # Assuming you have the ai_interpreter.py file
|
| 14 |
|
| 15 |
-
# Load environment variables (if you are using .env for API keys etc.)
|
| 16 |
load_dotenv()
|
| 17 |
|
| 18 |
def init_session_state():
|
|
@@ -154,50 +153,15 @@ def main():
|
|
| 154 |
# Display planetary positions
|
| 155 |
st.write("**Planetary Positions:**")
|
| 156 |
for planet, data in st.session_state.birth_chart['planets'].items():
|
| 157 |
-
|
| 158 |
-
st.write(f"{planet}: Could not calculate position")
|
| 159 |
-
else:
|
| 160 |
-
st.write(f"{planet}: {data['degrees']:.2f}° {data['sign']} in House {data['house']}")
|
| 161 |
|
| 162 |
with col2:
|
| 163 |
-
st.subheader("
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
"What are my relationship patterns according to this chart?",
|
| 170 |
-
"What are my greatest strengths based on this chart?"
|
| 171 |
-
]
|
| 172 |
-
|
| 173 |
-
selected_question = st.selectbox(
|
| 174 |
-
"Choose a question or type your own below:",
|
| 175 |
-
[""] + question_templates
|
| 176 |
-
)
|
| 177 |
-
|
| 178 |
-
custom_question = st.text_input(
|
| 179 |
-
"Ask about your chart:",
|
| 180 |
-
value=selected_question
|
| 181 |
-
)
|
| 182 |
-
|
| 183 |
-
if custom_question:
|
| 184 |
-
with st.spinner("Generating interpretation..."):
|
| 185 |
-
interpreter = AstroAI() # Replace with your actual AI interpreter class
|
| 186 |
-
interpretation = interpreter.get_interpretation(
|
| 187 |
-
st.session_state.birth_chart,
|
| 188 |
-
custom_question
|
| 189 |
-
)
|
| 190 |
-
st.session_state.chat_history.append({
|
| 191 |
-
"question": custom_question,
|
| 192 |
-
"answer": interpretation
|
| 193 |
-
})
|
| 194 |
-
|
| 195 |
-
# Display chat history
|
| 196 |
-
if st.session_state.chat_history:
|
| 197 |
-
st.write("**Previous Interpretations:**")
|
| 198 |
-
for exchange in st.session_state.chat_history:
|
| 199 |
-
with st.expander(f"Q: {exchange['question']}", expanded=False):
|
| 200 |
-
st.write(exchange['answer'])
|
| 201 |
|
| 202 |
if __name__ == "__main__":
|
| 203 |
-
main()
|
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
Streamlined Streamlit application for AI Astrology app with automatic timezone detection.
|
| 3 |
"""
|
|
|
|
| 11 |
from astro_core import ChartCalculator # Assuming you have the astro_core.py file
|
| 12 |
from ai_interpreter import AstroAI # Assuming you have the ai_interpreter.py file
|
| 13 |
|
| 14 |
+
# Load environment variables (if you are using .env for API keys, etc.)
|
| 15 |
load_dotenv()
|
| 16 |
|
| 17 |
def init_session_state():
|
|
|
|
| 153 |
# Display planetary positions
|
| 154 |
st.write("**Planetary Positions:**")
|
| 155 |
for planet, data in st.session_state.birth_chart['planets'].items():
|
| 156 |
+
st.write(f"{planet}: {data['degrees']:.2f}° {data['sign']}")
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
with col2:
|
| 159 |
+
st.subheader("Graphical Astrology Chart")
|
| 160 |
+
if st.button("Show Astrology Chart"):
|
| 161 |
+
# Generate and display graphical chart
|
| 162 |
+
calculator = ChartCalculator()
|
| 163 |
+
with st.spinner("Generating graphical chart..."):
|
| 164 |
+
calculator.draw_chart(st.session_state.birth_chart)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
if __name__ == "__main__":
|
| 167 |
+
main()
|