RonicTK89 commited on
Commit
0a4ca56
โ€ข
1 Parent(s): 8cff025

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -10
app.py CHANGED
@@ -4,21 +4,54 @@ import pandas as pd
4
  import matplotlib.pyplot as plt
5
  import seaborn as sns
6
 
 
 
 
7
 
8
- st.title("File Uploader")
9
- st.subheader("Input CSV")
10
- uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
11
 
 
12
  if uploaded_file is not None:
13
  data = pd.read_csv(uploaded_file)
14
- st.subheader("DataFrame")
15
- st.write(data)
 
 
 
 
 
16
  col1, col2 = st.columns(2)
 
17
  with col1:
18
- fig1 = plt.figure()
19
- sns.scatterplot(data=data, x='EstimatedSalary', y='Age', hue="Purchased")
 
 
 
 
 
20
  st.pyplot(fig1)
 
21
  with col2:
22
- fig2 = plt.figure()
23
- sns.histplot(data=data, x='Age')
24
- st.pyplot(fig2)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  import matplotlib.pyplot as plt
5
  import seaborn as sns
6
 
7
+ # App Title with Emojis
8
+ st.title("๐Ÿ“ **Welcome to the Insane File Uploader** ๐Ÿš€")
9
+ st.subheader("Upload a CSV file to visualize magic ๐Ÿ”ฎ")
10
 
11
+ # File Uploader
12
+ uploaded_file = st.file_uploader("Choose a CSV file to start:", type="csv")
 
13
 
14
+ # If a file is uploaded
15
  if uploaded_file is not None:
16
  data = pd.read_csv(uploaded_file)
17
+
18
+ # Display DataFrame with color
19
+ st.subheader("๐ŸŽฏ Here's your DataFrame ๐ŸŽฏ")
20
+ st.dataframe(data.style.highlight_max(axis=0, color='lightgreen')) # Highlight max values
21
+
22
+ # Create two columns for visuals
23
+ st.subheader("๐Ÿ“Š **Data Visualizations**")
24
  col1, col2 = st.columns(2)
25
+
26
  with col1:
27
+ st.markdown("### ๐Ÿ”ฅ **Scatter Plot: Salary vs Age**")
28
+ fig1 = plt.figure(figsize=(7, 5))
29
+ sns.scatterplot(data=data, x='EstimatedSalary', y='Age', hue="Purchased", palette='coolwarm', s=100)
30
+ plt.title("Estimated Salary vs Age", fontsize=14, fontweight='bold')
31
+ plt.xlabel("Estimated Salary", fontsize=12)
32
+ plt.ylabel("Age", fontsize=12)
33
+ plt.grid(True)
34
  st.pyplot(fig1)
35
+
36
  with col2:
37
+ st.markdown("### ๐ŸŽจ **Age Distribution**")
38
+ fig2 = plt.figure(figsize=(7, 5))
39
+ sns.histplot(data=data, x='Age', kde=True, color='purple', edgecolor='black')
40
+ plt.title("Age Distribution", fontsize=14, fontweight='bold')
41
+ plt.xlabel("Age", fontsize=12)
42
+ plt.ylabel("Frequency", fontsize=12)
43
+ plt.grid(True)
44
+ st.pyplot(fig2)
45
+
46
+ # Additional interactive feedback
47
+ st.balloons() # Fun balloons effect when file is uploaded
48
+ st.success("โœ… **Data successfully loaded and visualized!**")
49
+
50
+ # Footer section for fun
51
+ st.markdown("---")
52
+ st.markdown("๐Ÿ’ก *Powered by Streamlit & Seaborn | Stay Curious & Visualize Everything!* ๐Ÿง ")
53
+ else:
54
+ # Fun message if no file is uploaded yet
55
+ st.markdown("### โฌ†๏ธ **Upload a file to get started!**")
56
+ st.info("Hint: Make sure your CSV has columns like **EstimatedSalary, Age, and Purchased** for best results!")
57
+