Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
# zodiac_app.py (Streamlit version)
|
2 |
import streamlit as st
|
3 |
import pandas as pd
|
4 |
import datetime
|
5 |
import matplotlib.pyplot as plt
|
|
|
6 |
import io
|
7 |
|
8 |
# Data: zodiac signs with date ranges and personality traits
|
@@ -56,8 +56,37 @@ def get_zodiac_sign(month: int, day: int) -> str:
|
|
56 |
return sign
|
57 |
return None
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
# Streamlit UI
|
60 |
-
st.title('Zodiac
|
61 |
|
62 |
# Horoscope Section
|
63 |
st.header('Get Your Horoscope and Personality Traits')
|
@@ -71,6 +100,15 @@ if birthdate:
|
|
71 |
st.subheader(f"Your zodiac sign is: {sign}")
|
72 |
st.write(f"Personality Traits: {', '.join(traits)}")
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
# Compatibility Section
|
75 |
st.header('Check Compatibility Between Two Zodiac Signs')
|
76 |
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
import datetime
|
4 |
import matplotlib.pyplot as plt
|
5 |
+
import numpy as np
|
6 |
import io
|
7 |
|
8 |
# Data: zodiac signs with date ranges and personality traits
|
|
|
56 |
return sign
|
57 |
return None
|
58 |
|
59 |
+
# Function to create radar chart
|
60 |
+
def create_radar_chart(traits, values, sign):
|
61 |
+
num_vars = len(traits)
|
62 |
+
|
63 |
+
# Compute the angle for each trait (360 degrees divided by number of traits)
|
64 |
+
angles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()
|
65 |
+
|
66 |
+
# The plot needs to be circular, so we repeat the first value to close the loop
|
67 |
+
values += values[:1]
|
68 |
+
angles += angles[:1]
|
69 |
+
|
70 |
+
# Create the radar chart
|
71 |
+
fig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))
|
72 |
+
|
73 |
+
# Plot the data
|
74 |
+
ax.fill(angles, values, color='blue', alpha=0.25)
|
75 |
+
ax.plot(angles, values, color='blue', linewidth=2) # Outline of the chart
|
76 |
+
|
77 |
+
# Set the labels for each axis (the traits)
|
78 |
+
ax.set_yticklabels([]) # Remove the radial ticks
|
79 |
+
ax.set_xticks(angles[:-1]) # Set the ticks for each trait
|
80 |
+
ax.set_xticklabels(traits, color='black', fontsize=12)
|
81 |
+
|
82 |
+
# Add the title
|
83 |
+
ax.set_title(f'{sign} Personality Traits', size=14, color='black', fontweight='bold')
|
84 |
+
|
85 |
+
# Show the radar chart
|
86 |
+
return fig
|
87 |
+
|
88 |
# Streamlit UI
|
89 |
+
st.title('Zodiac Matcher')
|
90 |
|
91 |
# Horoscope Section
|
92 |
st.header('Get Your Horoscope and Personality Traits')
|
|
|
100 |
st.subheader(f"Your zodiac sign is: {sign}")
|
101 |
st.write(f"Personality Traits: {', '.join(traits)}")
|
102 |
|
103 |
+
# Display Radar Chart for Zodiac Sign
|
104 |
+
trait_values = [9, 10, 8, 9] # Example trait values for the radar chart (can be adjusted)
|
105 |
+
fig = create_radar_chart(traits, trait_values, sign)
|
106 |
+
|
107 |
+
buf = io.BytesIO()
|
108 |
+
fig.savefig(buf, format='png')
|
109 |
+
buf.seek(0)
|
110 |
+
st.image(buf)
|
111 |
+
|
112 |
# Compatibility Section
|
113 |
st.header('Check Compatibility Between Two Zodiac Signs')
|
114 |
|