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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -52,16 +52,16 @@ st.title("Fire Watch: AI-Powered Fire and Smoke Detection")
52
  # Custom HTML for images with hover effect
53
  col1, col2 = st.columns(2)
54
  with col1:
55
- fire_1_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_4.jpeg"
56
- fire_3a_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_4a.jpg"
57
- fire_1_bytes = requests.get(fire_1_url).content
58
- fire_3a_bytes = requests.get(fire_3a_url).content
59
- fire_1_b64 = base64.b64encode(fire_1_bytes).decode('utf-8')
60
- fire_3a_b64 = base64.b64encode(fire_3a_bytes).decode('utf-8')
61
  html1 = f"""
62
  <div style="position: relative; width: 100%;">
63
- <img src="data:image/jpeg;base64,{fire_1_b64}" style="width: 100%; height: auto;">
64
- <img src="data:image/jpeg;base64,{fire_3a_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>
@@ -70,15 +70,15 @@ with col1:
70
 
71
  with col2:
72
  fire_3_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_3.png"
73
- fire_4a_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_3a.jpg"
74
  fire_3_bytes = requests.get(fire_3_url).content
75
- fire_4a_bytes = requests.get(fire_4a_url).content
76
  fire_3_b64 = base64.b64encode(fire_3_bytes).decode('utf-8')
77
- fire_4a_b64 = base64.b64encode(fire_4a_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_4a_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>
@@ -87,10 +87,10 @@ with col2:
87
 
88
  st.markdown("""
89
  Early wildfire detection using YOLOv8 AI vision model. Hover over the images above to see detection results!
90
- See video examples below or upload your own to try it out!
91
  """)
92
 
93
- # Function to create synchronized video pair HTML (no hover changes here)
94
  def create_synced_video_pair(orig_url, proc_url, pair_id):
95
  try:
96
  orig_bytes = requests.get(orig_url).content
@@ -163,8 +163,8 @@ viewer_slot = st.empty()
163
  # Example videos with synchronization
164
  st.header("Example Results")
165
  examples = [
166
- ("LA Example", "LA1.mp4", "LA2.mp4")
167
  ("T Example", "T1.mp4", "T2.mp4"),
 
168
  ]
169
  for title, orig_file, proc_file in examples:
170
  st.subheader(title)
@@ -269,7 +269,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
 
 
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"
56
+ fire_4a_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_4a.jpg"
57
+ fire_4_bytes = requests.get(fire_4_url).content
58
+ fire_4a_bytes = requests.get(fire_4a_url).content
59
+ fire_4_b64 = base64.b64encode(fire_4_bytes).decode('utf-8')
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>
 
70
 
71
  with col2:
72
  fire_3_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_3.png"
73
+ fire_3a_url = "https://huggingface.co/spaces/tstone87/ccr-colorado/resolve/main/Fire_3a.jpg"
74
  fire_3_bytes = requests.get(fire_3_url).content
75
+ fire_3a_bytes = requests.get(fire_3a_url).content
76
  fire_3_b64 = base64.b64encode(fire_3_bytes).decode('utf-8')
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>
 
87
 
88
  st.markdown("""
89
  Early wildfire detection using YOLOv8 AI vision model. Hover over the images above to see detection results!
90
+ See video examples below or upload your own content!
91
  """)
92
 
93
+ # Function to create synchronized video pair HTML
94
  def create_synced_video_pair(orig_url, proc_url, pair_id):
95
  try:
96
  orig_bytes = requests.get(orig_url).content
 
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
  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