aamnansari commited on
Commit
29e7b9f
·
verified ·
1 Parent(s): 7a1b723

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py CHANGED
@@ -1,5 +1,45 @@
1
  import streamlit as st
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  def convert_temperature(value, from_unit, to_unit):
4
  if from_unit == to_unit:
5
  return value
@@ -35,3 +75,4 @@ to_unit = st.selectbox("To Unit:", units)
35
  if st.button("Convert"):
36
  converted_temp = convert_temperature(temp_value, from_unit, to_unit)
37
  st.success(f"The converted temperature is: **{converted_temp:.2f} {to_unit}**")
 
 
1
  import streamlit as st
2
 
3
+ # Custom CSS for the UI
4
+ st.markdown("""
5
+ <style>
6
+ /* Change the primary color of the app */
7
+ .stButton>button {
8
+ background-color: #1E90FF; /* Primary color */
9
+ color: white;
10
+ font-size: 16px;
11
+ font-weight: bold;
12
+ }
13
+
14
+ .stButton>button:hover {
15
+ background-color: #4682B4; /* Darker shade on hover */
16
+ }
17
+
18
+ /* Change input field style */
19
+ .stNumberInput>div>input {
20
+ background-color: #f0f8ff;
21
+ border-radius: 8px;
22
+ padding: 10px;
23
+ font-size: 16px;
24
+ }
25
+
26
+ /* Custom font for the title */
27
+ h1 {
28
+ font-family: 'Arial', sans-serif;
29
+ color: #2E8B57;
30
+ }
31
+
32
+ /* Styling the select box */
33
+ .stSelectbox>div>input {
34
+ background-color: #f0f8ff;
35
+ border-radius: 8px;
36
+ padding: 10px;
37
+ font-size: 16px;
38
+ }
39
+ </style>
40
+ """, unsafe_allow_html=True)
41
+
42
+ # Function to convert temperatures
43
  def convert_temperature(value, from_unit, to_unit):
44
  if from_unit == to_unit:
45
  return value
 
75
  if st.button("Convert"):
76
  converted_temp = convert_temperature(temp_value, from_unit, to_unit)
77
  st.success(f"The converted temperature is: **{converted_temp:.2f} {to_unit}**")
78
+