ayush200399391001 commited on
Commit
d3511e9
Β·
verified Β·
1 Parent(s): e3cb3b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -70,6 +70,7 @@ def extract_frames(video_path, output_folder="frames"):
70
 
71
  cap.release()
72
  return frame_count
 
73
  # -------------------- Optical Flow Calculation -------------------- #
74
  def calculate_optical_flow(frames_folder):
75
  """Calculates dense optical flow between consecutive frames with validation"""
@@ -211,7 +212,6 @@ def detect_manipulation(report_path="report.json"):
211
  except Exception as e:
212
  return f"❌ Error in analysis: {str(e)}"
213
 
214
- # -------------------- Reporting -------------------- #
215
  # -------------------- Reporting -------------------- #
216
  def generate_report(visual_results, flow_results, output_file="report.json"):
217
  """Generates comprehensive analysis report"""
@@ -231,8 +231,6 @@ def generate_report(visual_results, flow_results, output_file="report.json"):
231
  with open(output_file, "w") as f:
232
  json.dump(report_data, f, indent=2)
233
 
234
- # ... rest of visualization code ...
235
-
236
  return report_data # Added return statement
237
 
238
  # -------------------- Main Pipeline -------------------- #
@@ -264,13 +262,9 @@ def analyze_video(video_path):
264
 
265
 
266
  # -------------------- Execution -------------------- #
267
-
268
-
269
-
270
- #--------------------------------Streamlit---------------------------------------------#
271
- #--------------------------------Streamlit---------------------------------------------#
272
  import streamlit as st
273
  import tempfile
 
274
  def local_css(file_name):
275
  with open(file_name) as f:
276
  st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
@@ -315,7 +309,6 @@ if page == "Home":
315
  elif page == "Analyze Video":
316
  uploaded_file = st.file_uploader("Upload a Video", type=["mp4", "mov"], label_visibility="hidden")
317
 
318
-
319
  if uploaded_file is not None:
320
  # Save uploaded file to a temporary location
321
  with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as temp_file:
@@ -354,7 +347,7 @@ elif page == "Analyze Video":
354
  except Exception as e:
355
  st.error(f"An error occurred during analysis: {e}")
356
 
357
- elif page == "About": # βœ… Now this will work correctly
358
  st.markdown("<h1 class='title'>About Us</h1>", unsafe_allow_html=True)
359
 
360
  # Creator Profile
@@ -385,4 +378,4 @@ elif page == "About": # βœ… Now this will work correctly
385
  <img src='https://img.icons8.com/color/96/000000/opencv.png'/>
386
  <img src='https://raw.githubusercontent.com/github/explore/968d1eb8fb6b704c6be917f0000283face4f33ee/topics/streamlit/streamlit.png'/>
387
  </div>
388
- """, unsafe_allow_html=True)
 
70
 
71
  cap.release()
72
  return frame_count
73
+
74
  # -------------------- Optical Flow Calculation -------------------- #
75
  def calculate_optical_flow(frames_folder):
76
  """Calculates dense optical flow between consecutive frames with validation"""
 
212
  except Exception as e:
213
  return f"❌ Error in analysis: {str(e)}"
214
 
 
215
  # -------------------- Reporting -------------------- #
216
  def generate_report(visual_results, flow_results, output_file="report.json"):
217
  """Generates comprehensive analysis report"""
 
231
  with open(output_file, "w") as f:
232
  json.dump(report_data, f, indent=2)
233
 
 
 
234
  return report_data # Added return statement
235
 
236
  # -------------------- Main Pipeline -------------------- #
 
262
 
263
 
264
  # -------------------- Execution -------------------- #
 
 
 
 
 
265
  import streamlit as st
266
  import tempfile
267
+
268
  def local_css(file_name):
269
  with open(file_name) as f:
270
  st.markdown(f"<style>{f.read()}</style>", unsafe_allow_html=True)
 
309
  elif page == "Analyze Video":
310
  uploaded_file = st.file_uploader("Upload a Video", type=["mp4", "mov"], label_visibility="hidden")
311
 
 
312
  if uploaded_file is not None:
313
  # Save uploaded file to a temporary location
314
  with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as temp_file:
 
347
  except Exception as e:
348
  st.error(f"An error occurred during analysis: {e}")
349
 
350
+ elif page == "About":
351
  st.markdown("<h1 class='title'>About Us</h1>", unsafe_allow_html=True)
352
 
353
  # Creator Profile
 
378
  <img src='https://img.icons8.com/color/96/000000/opencv.png'/>
379
  <img src='https://raw.githubusercontent.com/github/explore/968d1eb8fb6b704c6be917f0000283face4f33ee/topics/streamlit/streamlit.png'/>
380
  </div>
381
+ """, unsafe_allow_html=True)