tstone87 commited on
Commit
fb52d4c
·
verified ·
1 Parent(s): ab6efec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -49,7 +49,7 @@ with st.sidebar:
49
  # Main page
50
  st.title("Fire Watch: AI-Powered Fire and Smoke Detection")
51
 
52
- # Custom HTML for images with hover effect
53
  col1, col2 = st.columns(2)
54
  with col1:
55
  fire_4_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_4.jpeg"
@@ -60,10 +60,14 @@ with col1:
60
  fire_4a_b64 = base64.b64encode(fire_4a_bytes).decode('utf-8')
61
  html1 = f"""
62
  <div style="position: relative; width: 100%;">
63
- <img src="data:image/jpeg;base64,{fire_4_b64}" style="width: 100%; height: auto;">
64
  <img src="data:image/jpeg;base64,{fire_4a_b64}"
65
- style="position: absolute; top: 0; left: 0; width: 100%; height: auto; opacity: 0; transition: opacity 0.3s;"
66
- onmouseover="this.style.opacity='1';" onmouseout="this.style.opacity='0';">
 
 
 
 
67
  </div>
68
  """
69
  st.markdown(html1, unsafe_allow_html=True)
@@ -77,10 +81,14 @@ with col2:
77
  fire_3a_b64 = base64.b64encode(fire_3a_bytes).decode('utf-8')
78
  html2 = f"""
79
  <div style="position: relative; width: 100%;">
80
- <img src="data:image/png;base64,{fire_3_b64}" style="width: 100%; height: auto;">
81
  <img src="data:image/jpeg;base64,{fire_3a_b64}"
82
- style="position: absolute; top: 0; left: 0; width: 100%; height: auto; opacity: 0; transition: opacity 0.3s;"
83
- onmouseover="this.style.opacity='1';" onmouseout="this.style.opacity='0';">
 
 
 
 
84
  </div>
85
  """
86
  st.markdown(html2, unsafe_allow_html=True)
@@ -160,11 +168,11 @@ st.header("Your Results")
160
  result_cols = st.columns(2)
161
  viewer_slot = st.empty()
162
 
163
- # Example videos with synchronization
164
  st.header("Example Results")
165
  examples = [
166
- ("T Example", "T1.mp4", "T2.mp4"),
167
- ("LA Example", "LA1.mp4", "LA2.mp4")
168
  ]
169
  for title, orig_file, proc_file in examples:
170
  st.subheader(title)
@@ -269,7 +277,7 @@ if process_button and source_file and model:
269
  download_slot.download_button(
270
  label="Download Processed Video",
271
  data=st.session_state.processed_video,
272
- file_name="results_fire_analysis.mp4",
273
  mime="video/mp4"
274
  )
275
 
 
49
  # Main page
50
  st.title("Fire Watch: AI-Powered Fire and Smoke Detection")
51
 
52
+ # Custom HTML for images with hover effect using CSS
53
  col1, col2 = st.columns(2)
54
  with col1:
55
  fire_4_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_4.jpeg"
 
60
  fire_4a_b64 = base64.b64encode(fire_4a_bytes).decode('utf-8')
61
  html1 = f"""
62
  <div style="position: relative; width: 100%;">
63
+ <img src="data:image/jpeg;base64,{fire_4_b64}" style="width: 100%; height: auto; display: block;">
64
  <img src="data:image/jpeg;base64,{fire_4a_b64}"
65
+ style="position: absolute; top: 0; left: 0; width: 100%; height: auto; opacity: 0; transition: opacity 0.3s;">
66
+ <style>
67
+ div:hover > img:nth-child(2) {{
68
+ opacity: 1;
69
+ }}
70
+ </style>
71
  </div>
72
  """
73
  st.markdown(html1, unsafe_allow_html=True)
 
81
  fire_3a_b64 = base64.b64encode(fire_3a_bytes).decode('utf-8')
82
  html2 = f"""
83
  <div style="position: relative; width: 100%;">
84
+ <img src="data:image/png;base64,{fire_3_b64}" style="width: 100%; height: auto; display: block;">
85
  <img src="data:image/jpeg;base64,{fire_3a_b64}"
86
+ style="position: absolute; top: 0; left: 0; width: 100%; height: auto; opacity: 0; transition: opacity 0.3s;">
87
+ <style>
88
+ div:hover > img:nth-child(2) {{
89
+ opacity: 1;
90
+ }}
91
+ </style>
92
  </div>
93
  """
94
  st.markdown(html2, unsafe_allow_html=True)
 
168
  result_cols = st.columns(2)
169
  viewer_slot = st.empty()
170
 
171
+ # Example videos with synchronization (LA before T)
172
  st.header("Example Results")
173
  examples = [
174
+ ("LA Example", "LA1.mp4", "LA2.mp4"),
175
+ ("T Example", "T1.mp4", "T2.mp4")
176
  ]
177
  for title, orig_file, proc_file in examples:
178
  st.subheader(title)
 
277
  download_slot.download_button(
278
  label="Download Processed Video",
279
  data=st.session_state.processed_video,
280
+ file_name="processed_wildfire.mp4",
281
  mime="video/mp4"
282
  )
283