shukdevdatta123 commited on
Commit
cec4b18
·
verified ·
1 Parent(s): e668da4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +80 -2
app.py CHANGED
@@ -2,6 +2,80 @@ import streamlit as st
2
  import time
3
  from PIL import Image
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # Bubble Sort Algorithm with animation
6
  def bubble_sort(arr):
7
  steps = []
@@ -48,12 +122,16 @@ def animate_sorting(steps):
48
 
49
  # Streamlit App Interface
50
  def main():
 
 
 
51
  # Sidebar with two options: "Try Simulation" and "Detailed Explanation"
52
  st.sidebar.title("Sorting Algorithm Options")
53
  option = st.sidebar.radio("Choose an option:", ("Detailed Explanation", "Try Simulation"))
54
-
 
55
  st.sidebar.image("sort.png", use_container_width=True) # Replace with your image path
56
-
57
  if option == "Try Simulation":
58
  st.title("Sorting Algorithms Visualization")
59
 
 
2
  import time
3
  from PIL import Image
4
 
5
+ # Inject Custom CSS for Aesthetic Enhancements
6
+ def inject_custom_css():
7
+ st.markdown("""
8
+ <style>
9
+ /* Overall page styling */
10
+ body {
11
+ background-color: #f4f7fa;
12
+ font-family: 'Arial', sans-serif;
13
+ }
14
+
15
+ /* Sidebar styling */
16
+ .css-1d391kg {
17
+ background-color: #ffffff;
18
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
19
+ border-radius: 12px;
20
+ }
21
+
22
+ .css-1d391kg .sidebar-content {
23
+ padding: 2rem;
24
+ }
25
+
26
+ /* Title and Headers */
27
+ h1 {
28
+ font-size: 2.5rem;
29
+ color: #333333;
30
+ font-weight: 600;
31
+ }
32
+ h2, h3 {
33
+ color: #4c4c4c;
34
+ font-weight: 500;
35
+ }
36
+
37
+ /* Button styling */
38
+ .css-1emrehy {
39
+ background-color: #ff4c4c;
40
+ color: white;
41
+ padding: 10px 24px;
42
+ border-radius: 6px;
43
+ font-size: 1rem;
44
+ border: none;
45
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
46
+ cursor: pointer;
47
+ }
48
+
49
+ .css-1emrehy:hover {
50
+ background-color: #ff7b7b;
51
+ }
52
+
53
+ /* Text input styling */
54
+ .css-1bppn4z input {
55
+ border: 2px solid #ddd;
56
+ border-radius: 8px;
57
+ padding: 12px;
58
+ font-size: 1rem;
59
+ }
60
+
61
+ /* Code blocks (steps) */
62
+ pre {
63
+ background-color: #f4f4f4;
64
+ padding: 1rem;
65
+ border-radius: 8px;
66
+ font-family: 'Courier New', monospace;
67
+ color: #333333;
68
+ }
69
+
70
+ /* Image styling */
71
+ img {
72
+ border-radius: 8px;
73
+ box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
74
+ }
75
+
76
+ </style>
77
+ """, unsafe_allow_html=True)
78
+
79
  # Bubble Sort Algorithm with animation
80
  def bubble_sort(arr):
81
  steps = []
 
122
 
123
  # Streamlit App Interface
124
  def main():
125
+ # Inject custom CSS for aesthetics
126
+ inject_custom_css()
127
+
128
  # Sidebar with two options: "Try Simulation" and "Detailed Explanation"
129
  st.sidebar.title("Sorting Algorithm Options")
130
  option = st.sidebar.radio("Choose an option:", ("Detailed Explanation", "Try Simulation"))
131
+
132
+ # Sidebar image
133
  st.sidebar.image("sort.png", use_container_width=True) # Replace with your image path
134
+
135
  if option == "Try Simulation":
136
  st.title("Sorting Algorithms Visualization")
137