shubham680 commited on
Commit
d5172eb
·
verified ·
1 Parent(s): b9882c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -5
app.py CHANGED
@@ -3,6 +3,63 @@ import numpy as np
3
  import sympy as sp
4
  import plotly.graph_objs as go
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  st.title("Gradient Descent Visualizer")
7
 
8
  x = sp.Symbol("x")
@@ -70,8 +127,4 @@ if 'func' in st.session_state and len(st.session_state.points) > 0:
70
  )
71
 
72
  fig = go.Figure(data=[trace1, trace2, trace3], layout=layout)
73
- st.plotly_chart(fig, use_container_width=True)
74
- st.success(f"Current Point = {iter_points[-1]}")
75
-
76
- except Exception as e:
77
- st.error(f"Plot error: {e}")
 
3
  import sympy as sp
4
  import plotly.graph_objs as go
5
 
6
+ # Custom CSS for styling
7
+ st.markdown("""
8
+ <style>
9
+ /* Page background */
10
+ .stApp {
11
+ background-color: #f9f9f9;
12
+ font-family: 'Segoe UI', sans-serif;
13
+ }
14
+
15
+ /* Title */
16
+ h1 {
17
+ text-align: center;
18
+ color: #2C3E50;
19
+ font-size: 38px !important;
20
+ font-weight: bold;
21
+ margin-bottom: 20px;
22
+ }
23
+
24
+ /* Input boxes */
25
+ .stTextInput > div > div > input {
26
+ border: 2px solid #3498DB;
27
+ border-radius: 8px;
28
+ padding: 8px;
29
+ }
30
+
31
+ /* Buttons */
32
+ div.stButton > button {
33
+ background-color: #3498DB;
34
+ color: white;
35
+ border-radius: 10px;
36
+ padding: 10px 24px;
37
+ font-size: 16px;
38
+ border: none;
39
+ transition: 0.3s;
40
+ }
41
+ div.stButton > button:hover {
42
+ background-color: #2980B9;
43
+ transform: scale(1.05);
44
+ }
45
+
46
+ /* Success / Error messages */
47
+ .stAlert {
48
+ border-radius: 8px;
49
+ }
50
+
51
+ /* Chart section */
52
+ .block-container {
53
+ padding-top: 2rem;
54
+ padding-bottom: 2rem;
55
+ }
56
+ </style>
57
+ """, unsafe_allow_html=True)
58
+
59
+ # -------------------------------
60
+ # your original code below 👇
61
+ # -------------------------------
62
+
63
  st.title("Gradient Descent Visualizer")
64
 
65
  x = sp.Symbol("x")
 
127
  )
128
 
129
  fig = go.Figure(data=[trace1, trace2, trace3], layout=layout)
130
+ st.plotly_chart(fig,_