Mavhas commited on
Commit
25d6fb4
·
verified ·
1 Parent(s): 608d9c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -90
app.py CHANGED
@@ -12,89 +12,10 @@ st.markdown(
12
  background: linear-gradient(to bottom right, #e0eafc, #cfdef3);
13
  color: #333;
14
  }
15
- .converter-container {
16
- background-color: rgba(255, 255, 255, 0.9);
17
- border-radius: 15px;
18
- padding: 40px;
19
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
20
- max-width: 800px;
21
- margin: 30px auto;
22
- }
23
- .input-group {
24
- margin-bottom: 25px;
25
- }
26
- .input-group label {
27
- font-weight: 600;
28
- margin-bottom: 10px;
29
- color: #555;
30
- }
31
- .stSelectbox, .stNumberInput {
32
- border: 1px solid #ced4da;
33
- border-radius: 5px;
34
- padding: 10px;
35
- }
36
- .stButton>button {
37
- background-color: #2196f3;
38
- color: white;
39
- padding: 14px 25px;
40
- border: none;
41
- border-radius: 8px;
42
- cursor: pointer;
43
- width: 100%;
44
- font-size: 16px;
45
- transition: background-color 0.3s ease;
46
- box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);
47
- }
48
- .stButton>button:hover {
49
- background-color: #1976d2;
50
- box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
51
- }
52
- .result-area {
53
- margin-top: 30px;
54
- padding: 20px;
55
- border: 1px solid #d0d0d0;
56
- border-radius: 8px;
57
- background-color: #f5f5f5;
58
- font-size: 1.3em;
59
- font-weight: 500;
60
- text-align: center;
61
- color: #444;
62
- box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.05);
63
- }
64
- .quote {
65
- font-style: italic;
66
- color: #666;
67
- margin-top: 30px;
68
- text-align: center;
69
- font-size: 1.1em;
70
- }
71
- .image-container {
72
- text-align: center;
73
- margin-bottom: 30px;
74
- }
75
- .section-heading {
76
- font-size: 1.6em;
77
- font-weight: bold;
78
- margin-bottom: 15px;
79
- color: #2c3e50;
80
- text-align: center;
81
- }
82
- .thermometer-image {
83
- width: 250px;
84
- margin: 0 auto;
85
- display: block;
86
- }
87
- .unit-image {
88
- width: 80px;
89
- margin: 10px;
90
- border-radius: 5px;
91
- box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
92
- }
93
- .unit-image-container {
94
- display: flex;
95
- justify-content: center;
96
- margin-top: 10px;
97
- }
98
  </style>
99
  """,
100
  unsafe_allow_html=True,
@@ -103,8 +24,8 @@ st.markdown(
103
  st.title("Temperature Converter")
104
 
105
  with st.container() as converter_container:
106
- # Main Thermometer Image (REPLACE with your image URL or local file)
107
- st.markdown("<div class='image-container'><img class='thermometer-image' src='thermometer.png' alt='Thermometer'></div>", unsafe_allow_html=True) # Example - REPLACE with your image
108
 
109
  col1, col2 = st.columns([1, 1])
110
 
@@ -113,7 +34,7 @@ with st.container() as converter_container:
113
  temperature = st.number_input("Temperature", value=0.0)
114
  unit_from = st.selectbox("From", ["Celsius", "Fahrenheit", "Kelvin"])
115
 
116
- # Unit Images (Input Side - REPLACE image URLs or use local files)
117
  st.markdown("<div class='unit-image-container'>")
118
  if unit_from == "Celsius":
119
  st.markdown("<img class='unit-image' src='celsius.png' alt='Celsius'>", unsafe_allow_html=True)
@@ -127,7 +48,7 @@ with st.container() as converter_container:
127
  st.markdown("<h2 class='section-heading'>Output</h2>", unsafe_allow_html=True)
128
  unit_to = st.selectbox("To", ["Celsius", "Fahrenheit", "Kelvin"])
129
 
130
- # Unit Images (Output Side - REPLACE image URLs or use local files)
131
  st.markdown("<div class='unit-image-container'>")
132
  if unit_to == "Celsius":
133
  st.markdown("<img class='unit-image' src='celsius.png' alt='Celsius'>", unsafe_allow_html=True)
@@ -137,7 +58,6 @@ with st.container() as converter_container:
137
  st.markdown("<img class='unit-image' src='kelvin.png' alt='Kelvin'>", unsafe_allow_html=True)
138
  st.markdown("</div>")
139
 
140
-
141
  if st.button("Convert"):
142
  if unit_from == unit_to:
143
  result = temperature
@@ -158,7 +78,7 @@ with st.container() as converter_container:
158
 
159
  # Image Upload (Optional - for local development)
160
  st.subheader("Upload Image (Optional)")
161
- uploaded_file = st.file_uploader("temp", type=["jpeg"])
162
 
163
  if uploaded_file is not None:
164
  image = Image.open(uploaded_file)
@@ -172,4 +92,7 @@ with st.container() as converter_container:
172
  # f.write(uploaded_file.getbuffer())
173
  # st.success("Image saved!")
174
 
175
- st.markdown("<p class='quote'>\"The only way to
 
 
 
 
12
  background: linear-gradient(to bottom right, #e0eafc, #cfdef3);
13
  color: #333;
14
  }
15
+ .converter-container { /* ... (rest of your CSS styles - same as before) ... */ }
16
+ .thermometer-image { /* ... (rest of your CSS styles - same as before) ... */ }
17
+ .unit-image { /* ... (rest of your CSS styles - same as before) ... */ }
18
+ .unit-image-container { /* ... (rest of your CSS styles - same as before) ... */ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </style>
20
  """,
21
  unsafe_allow_html=True,
 
24
  st.title("Temperature Converter")
25
 
26
  with st.container() as converter_container:
27
+ # Main Thermometer Image (Local File - For Hugging Face - REPLACE if needed)
28
+ st.markdown("<div class='image-container'><img class='thermometer-image' src='temp.jpeg' alt='Thermometer'></div>", unsafe_allow_html=True) # Use the filename directly
29
 
30
  col1, col2 = st.columns([1, 1])
31
 
 
34
  temperature = st.number_input("Temperature", value=0.0)
35
  unit_from = st.selectbox("From", ["Celsius", "Fahrenheit", "Kelvin"])
36
 
37
+ # Unit Images (Local Files - For Hugging Face - REPLACE if needed)
38
  st.markdown("<div class='unit-image-container'>")
39
  if unit_from == "Celsius":
40
  st.markdown("<img class='unit-image' src='celsius.png' alt='Celsius'>", unsafe_allow_html=True)
 
48
  st.markdown("<h2 class='section-heading'>Output</h2>", unsafe_allow_html=True)
49
  unit_to = st.selectbox("To", ["Celsius", "Fahrenheit", "Kelvin"])
50
 
51
+ # Unit Images (Local Files - For Hugging Face - REPLACE if needed)
52
  st.markdown("<div class='unit-image-container'>")
53
  if unit_to == "Celsius":
54
  st.markdown("<img class='unit-image' src='celsius.png' alt='Celsius'>", unsafe_allow_html=True)
 
58
  st.markdown("<img class='unit-image' src='kelvin.png' alt='Kelvin'>", unsafe_allow_html=True)
59
  st.markdown("</div>")
60
 
 
61
  if st.button("Convert"):
62
  if unit_from == unit_to:
63
  result = temperature
 
78
 
79
  # Image Upload (Optional - for local development)
80
  st.subheader("Upload Image (Optional)")
81
+ uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
82
 
83
  if uploaded_file is not None:
84
  image = Image.open(uploaded_file)
 
92
  # f.write(uploaded_file.getbuffer())
93
  # st.success("Image saved!")
94
 
95
+ 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)
96
+
97
+ st.markdown("---")
98
+ st.write("Made with Streamlit")