Krish Patel
commited on
Commit
·
c847237
1
Parent(s):
51956dc
Enhanced UI
Browse files
app.py
CHANGED
@@ -82,18 +82,42 @@ def main():
|
|
82 |
|
83 |
if file_type == 'image':
|
84 |
results, image = process_image_in_memory(file)
|
85 |
-
st.image(image, caption="Uploaded Image",
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
|
89 |
elif file_type == 'video':
|
90 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
if st.button("Analyze Video"):
|
93 |
with st.spinner("Analyzing video frames..."):
|
94 |
results = process_video_in_memory(file)
|
95 |
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
main()
|
|
|
82 |
|
83 |
if file_type == 'image':
|
84 |
results, image = process_image_in_memory(file)
|
85 |
+
st.image(image, caption="Uploaded Image", width=500)
|
86 |
+
|
87 |
+
if st.button("Analyze Image"):
|
88 |
+
with st.spinner("Analyzing..."):
|
89 |
+
display_detailed_analysis(results)
|
90 |
|
91 |
elif file_type == 'video':
|
92 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
93 |
+
with col2:
|
94 |
+
# Set a smaller width for the video container
|
95 |
+
st.markdown('<div style="width: 300px; margin: auto;">', unsafe_allow_html=True)
|
96 |
+
st.video(file, format="video/mp4", start_time=0)
|
97 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
98 |
|
99 |
if st.button("Analyze Video"):
|
100 |
with st.spinner("Analyzing video frames..."):
|
101 |
results = process_video_in_memory(file)
|
102 |
|
103 |
+
# Display results
|
104 |
+
st.subheader("Video Analysis Results")
|
105 |
+
col1, col2 = st.columns(2)
|
106 |
+
|
107 |
+
with col1:
|
108 |
+
st.metric("Final Prediction", results["Final Video Prediction"])
|
109 |
+
st.metric("Confidence Score", f"{results['Confidence Score']*100:.2f}%")
|
110 |
+
|
111 |
+
with col2:
|
112 |
+
st.metric("Fake Frames", results["Fake Frames"])
|
113 |
+
st.metric("Real Frames", results["Real Frames"])
|
114 |
+
|
115 |
+
# Detailed frame analysis
|
116 |
+
st.write("📊 Frame Analysis:")
|
117 |
+
st.write(f"- **Total Frames Analyzed**: {results['Total Frames Analyzed']}")
|
118 |
+
st.write(f"- **Fake Frames**: {results['Fake Frames']}")
|
119 |
+
st.write(f"- **Real Frames**: {results['Real Frames']}")
|
120 |
+
st.write(f"- **Fake Content Percentage**: {results['Fake Percentage']}%")
|
121 |
|
122 |
if __name__ == "__main__":
|
123 |
main()
|