CoderHassan commited on
Commit
4779692
·
verified ·
1 Parent(s): 6fa5f8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +80 -1
app.py CHANGED
@@ -1,5 +1,84 @@
1
  import streamlit as st
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  # Title and Description
4
  st.title("Temperature Conversion App")
5
  st.markdown("Convert temperatures between Celsius, Fahrenheit, and Kelvin.")
@@ -38,4 +117,4 @@ elif conversion_type == "Fahrenheit to Kelvin":
38
  st.write(f"{temp_input:.2f}°F is equal to {converted_temp:.2f} K.")
39
  elif conversion_type == "Kelvin to Fahrenheit":
40
  converted_temp = (temp_input - 273.15) * 9/5 + 32
41
- st.write(f"{temp_input:.2f} K is equal to {converted_temp:.2f}°F.")
 
1
  import streamlit as st
2
 
3
+ # -----------------------------
4
+ # PAGE CONFIG
5
+ # -----------------------------
6
+ st.set_page_config(
7
+ page_title="Temperature Converter",
8
+ page_icon="🌡️",
9
+ layout="centered"
10
+ )
11
+
12
+ # -----------------------------
13
+ # NEON + ANIMATED UI (ONLY ADDITION)
14
+ # -----------------------------
15
+ st.markdown("""
16
+ <style>
17
+
18
+ /* Animated Background */
19
+ .stApp {
20
+ background: linear-gradient(-45deg, #0f172a, #1e293b, #0b1220, #1e3a8a);
21
+ background-size: 400% 400%;
22
+ animation: gradientMove 10s ease infinite;
23
+ color: white;
24
+ }
25
+
26
+ @keyframes gradientMove {
27
+ 0% {background-position: 0% 50%;}
28
+ 50% {background-position: 100% 50%;}
29
+ 100% {background-position: 0% 50%;}
30
+ }
31
+
32
+ /* Title Glow */
33
+ h1 {
34
+ text-align: center;
35
+ color: white;
36
+ text-shadow:
37
+ 0 0 10px #38bdf8,
38
+ 0 0 20px #0ea5e9,
39
+ 0 0 40px #3b82f6;
40
+ }
41
+
42
+ /* Glass Effect */
43
+ .block-container {
44
+ background: rgba(255,255,255,0.05);
45
+ padding: 25px;
46
+ border-radius: 20px;
47
+ backdrop-filter: blur(12px);
48
+ box-shadow: 0 8px 30px rgba(0,0,0,0.4);
49
+ animation: floatCard 4s ease-in-out infinite;
50
+ }
51
+
52
+ @keyframes floatCard {
53
+ 0% {transform: translateY(0px);}
54
+ 50% {transform: translateY(-5px);}
55
+ 100% {transform: translateY(0px);}
56
+ }
57
+
58
+ /* Button Styling */
59
+ .stButton>button {
60
+ width: 100%;
61
+ background: linear-gradient(90deg, #06b6d4, #3b82f6);
62
+ color: white;
63
+ border-radius: 12px;
64
+ height: 3em;
65
+ font-size: 16px;
66
+ border: none;
67
+ box-shadow: 0 0 15px rgba(59,130,246,0.6);
68
+ }
69
+
70
+ .stButton>button:hover {
71
+ transform: scale(1.03);
72
+ box-shadow: 0 0 25px rgba(59,130,246,0.9);
73
+ }
74
+
75
+ </style>
76
+ """, unsafe_allow_html=True)
77
+
78
+ # -----------------------------
79
+ # YOUR ORIGINAL CODE (UNCHANGED)
80
+ # -----------------------------
81
+
82
  # Title and Description
83
  st.title("Temperature Conversion App")
84
  st.markdown("Convert temperatures between Celsius, Fahrenheit, and Kelvin.")
 
117
  st.write(f"{temp_input:.2f}°F is equal to {converted_temp:.2f} K.")
118
  elif conversion_type == "Kelvin to Fahrenheit":
119
  converted_temp = (temp_input - 273.15) * 9/5 + 32
120
+ st.write(f"{temp_input:.2f} K is equal to {converted_temp:.2f}°F.")