Mavhas commited on
Commit
f7a511f
·
verified ·
1 Parent(s): f51016c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -37
app.py CHANGED
@@ -1,86 +1,105 @@
1
- # app.py
2
  import streamlit as st
3
 
4
  st.set_page_config(page_title="Temperature Converter", page_icon=":thermometer:", layout="wide")
5
 
6
- # Custom CSS for styling
7
  st.markdown(
8
  """
9
  <style>
10
  body {
11
- font-family: 'Arial', sans-serif;
12
- background-color: #f4f4f4;
 
13
  }
14
  .converter-container {
15
- border: 1px solid #ddd;
16
- padding: 30px; /* Increased padding */
17
- border-radius: 10px;
18
- box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.1);
19
- background-color: white;
20
- max-width: 700px; /* Increased container width */
21
- margin: 20px auto; /* Added margin top/bottom */
22
  }
23
  .input-group {
24
- margin-bottom: 20px; /* Increased margin */
25
  }
26
  .input-group label {
27
- font-weight: bold;
28
- margin-bottom: 8px;
 
 
 
 
 
 
29
  }
30
  .stButton>button {
31
- background-color: #007bff;
32
  color: white;
33
- padding: 12px 20px;
34
  border: none;
35
- border-radius: 5px;
36
  cursor: pointer;
37
  width: 100%;
 
 
 
38
  }
39
  .stButton>button:hover {
40
- background-color: #0056b3;
 
41
  }
42
  .result-area {
43
- margin-top: 25px; /* Increased margin */
44
- padding: 18px; /* Increased padding */
45
- border: 1px solid #ddd;
46
- border-radius: 5px;
47
- background-color: #f9f9f9;
48
- font-size: 1.2em;
49
- font-weight: bold;
50
- text-align: center; /* Center the result */
 
 
51
  }
52
  .quote {
53
  font-style: italic;
54
- color: #777;
55
- margin-top: 20px;
56
  text-align: center;
 
57
  }
58
  .image-container {
59
- text-align: center; /* Center the image */
60
- margin-bottom: 20px;
 
 
 
 
 
 
 
61
  }
62
  </style>
63
  """,
64
  unsafe_allow_html=True,
65
  )
66
 
67
- st.title("Temperature Converter")
68
 
69
- with st.container() as converter_container:
70
 
71
- # Image (replace with your image URL or upload)
72
- st.markdown("<div class='image-container'><img src='https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Thermometer_showing_38_degree_Celsius.svg/1200px-Thermometer_showing_38_degree_Celsius.svg.png' alt='Thermometer' width='200'></div>", unsafe_allow_html=True)
73
 
 
 
 
74
 
75
  col1, col2 = st.columns([1, 1])
76
 
77
  with col1:
78
- st.subheader("Input")
79
  temperature = st.number_input("Temperature", value=0.0)
80
  unit_from = st.selectbox("From", ["Celsius", "Fahrenheit", "Kelvin"])
81
 
82
  with col2:
83
- st.subheader("Output")
84
  unit_to = st.selectbox("To", ["Celsius", "Fahrenheit", "Kelvin"])
85
 
86
  if st.button("Convert"):
@@ -102,7 +121,6 @@ with st.container() as converter_container:
102
 
103
  st.markdown(f"<div class='result-area'>Result: {result:.2f} {unit_to}</div>", unsafe_allow_html=True)
104
 
105
-
106
  # Quote
107
  st.markdown("<p class='quote'>\"The only way to do great work is to love what you do.\" - Steve Jobs</p>", unsafe_allow_html=True)
108
 
 
 
1
  import streamlit as st
2
 
3
  st.set_page_config(page_title="Temperature Converter", page_icon=":thermometer:", layout="wide")
4
 
5
+ # Custom CSS for a more polished look
6
  st.markdown(
7
  """
8
  <style>
9
  body {
10
+ font-family: 'Roboto', sans-serif; /* Modern font */
11
+ background: linear-gradient(to bottom right, #e0eafc, #cfdef3); /* Gradient background */
12
+ color: #333; /* Darker text color */
13
  }
14
  .converter-container {
15
+ background-color: rgba(255, 255, 255, 0.9); /* Semi-transparent white background */
16
+ border-radius: 15px;
17
+ padding: 40px;
18
+ box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); /* More prominent shadow */
19
+ max-width: 800px; /* Increased width */
20
+ margin: 30px auto;
 
21
  }
22
  .input-group {
23
+ margin-bottom: 25px;
24
  }
25
  .input-group label {
26
+ font-weight: 600; /* Semi-bold labels */
27
+ margin-bottom: 10px;
28
+ color: #555;
29
+ }
30
+ .stSelectbox, .stNumberInput {
31
+ border: 1px solid #ced4da; /* Light border for inputs */
32
+ border-radius: 5px;
33
+ padding: 10px;
34
  }
35
  .stButton>button {
36
+ background-color: #2196f3; /* Modern blue button */
37
  color: white;
38
+ padding: 14px 25px;
39
  border: none;
40
+ border-radius: 8px;
41
  cursor: pointer;
42
  width: 100%;
43
+ font-size: 16px; /* Larger font size */
44
+ transition: background-color 0.3s ease; /* Smooth transition */
45
+ box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15); /* Button shadow */
46
  }
47
  .stButton>button:hover {
48
+ background-color: #1976d2; /* Darker blue on hover */
49
+ box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2); /* Increased shadow on hover */
50
  }
51
  .result-area {
52
+ margin-top: 30px;
53
+ padding: 20px;
54
+ border: 1px solid #d0d0d0; /* Subtler border */
55
+ border-radius: 8px;
56
+ background-color: #f5f5f5;
57
+ font-size: 1.3em;
58
+ font-weight: 500;
59
+ text-align: center;
60
+ color: #444;
61
+ box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05); /* Inner shadow */
62
  }
63
  .quote {
64
  font-style: italic;
65
+ color: #666;
66
+ margin-top: 30px;
67
  text-align: center;
68
+ font-size: 1.1em;
69
  }
70
  .image-container {
71
+ text-align: center;
72
+ margin-bottom: 30px;
73
+ }
74
+ .section-heading {
75
+ font-size: 1.6em;
76
+ font-weight: bold;
77
+ margin-bottom: 15px;
78
+ color: #2c3e50; /* Darker heading color */
79
+ text-align: center; /* Center the headings */
80
  }
81
  </style>
82
  """,
83
  unsafe_allow_html=True,
84
  )
85
 
 
86
 
 
87
 
88
+ st.title("Temperature Converter")
 
89
 
90
+ with st.container() as converter_container:
91
+ # Image
92
+ st.markdown("<div class='image-container'><img src='https://upload.wikimedia.org/wikipedia/commons/thumb/f/f9/Thermometer_showing_38_degree_Celsius.svg/1200px-Thermometer_showing_38_degree_Celsius.svg.png' alt='Thermometer' width='250'></div>", unsafe_allow_html=True)
93
 
94
  col1, col2 = st.columns([1, 1])
95
 
96
  with col1:
97
+ st.markdown("<h2 class='section-heading'>Input</h2>", unsafe_allow_html=True) # Section heading
98
  temperature = st.number_input("Temperature", value=0.0)
99
  unit_from = st.selectbox("From", ["Celsius", "Fahrenheit", "Kelvin"])
100
 
101
  with col2:
102
+ st.markdown("<h2 class='section-heading'>Output</h2>", unsafe_allow_html=True) # Section heading
103
  unit_to = st.selectbox("To", ["Celsius", "Fahrenheit", "Kelvin"])
104
 
105
  if st.button("Convert"):
 
121
 
122
  st.markdown(f"<div class='result-area'>Result: {result:.2f} {unit_to}</div>", unsafe_allow_html=True)
123
 
 
124
  # Quote
125
  st.markdown("<p class='quote'>\"The only way to do great work is to love what you do.\" - Steve Jobs</p>", unsafe_allow_html=True)
126