import os # Streamlit config dosyasını kullanıcının home dizininde oluştur config_dir = os.path.join(os.path.expanduser("~"), ".streamlit") os.makedirs(config_dir, exist_ok=True) config_path = os.path.join(config_dir, "config.toml") with open(config_path, "w") as f: f.write(""" [server] headless = true port = $PORT enableCORS = false """) import streamlit as st import tempfile from movement_detector import extract_frames, detect_camera_movement st.set_page_config(page_title="Camera Movement Detector", layout="centered") # CSS + HTML (Profesyonel Tasarım) st.markdown(""" """, unsafe_allow_html=True) # 🔹 Logo st.markdown("""
ATP Logo
""", unsafe_allow_html=True) # 🔹 İçerik Kartı st.markdown('
', unsafe_allow_html=True) st.markdown('
📷 Camera Movement Detector
', unsafe_allow_html=True) st.markdown('
Upload a video to detect significant camera movement (not object motion).
', unsafe_allow_html=True) # 🔸 Dosya yükleyici uploaded_video = st.file_uploader("🎞️ Upload your video", type=["mp4", "avi", "mov"]) # 🔸 Analiz işlemi if uploaded_video: with tempfile.NamedTemporaryFile(delete=False) as temp_file: temp_file.write(uploaded_video.read()) temp_video_path = temp_file.name st.info("Extracting frames...") frames = extract_frames(temp_video_path) st.info("Analyzing for camera movement...") with st.spinner("Running detection..."): indices = detect_camera_movement(frames) st.success("✅ Detection complete.") st.markdown(f"
📌 Movement detected at frames:
{indices}
", unsafe_allow_html=True) st.markdown('
', unsafe_allow_html=True)