Spaces:
Build error
Build error
Commit
·
6629b55
1
Parent(s):
2c2574b
Corregir posición de st.set_page_config para asegurar que es el primer comando Streamlit
Browse files- streamlit_app.py +22 -11
streamlit_app.py
CHANGED
|
@@ -1,4 +1,14 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import cv2
|
| 3 |
import numpy as np
|
| 4 |
from PIL import Image
|
|
@@ -8,13 +18,20 @@ import tempfile
|
|
| 8 |
import os
|
| 9 |
import time
|
| 10 |
import urllib.request
|
|
|
|
|
|
|
| 11 |
import matplotlib.pyplot as plt
|
| 12 |
import pickle
|
| 13 |
from sklearn.metrics.pairwise import cosine_similarity # type: ignore
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Importar las utilidades para la base de datos de rostros
|
| 20 |
try:
|
|
@@ -41,13 +58,7 @@ except ImportError:
|
|
| 41 |
|
| 42 |
# Función principal que encapsula toda la aplicación
|
| 43 |
def main():
|
| 44 |
-
#
|
| 45 |
-
st.set_page_config(
|
| 46 |
-
page_title="Advanced Face & Feature Detection",
|
| 47 |
-
page_icon="👤",
|
| 48 |
-
layout="wide",
|
| 49 |
-
initial_sidebar_state="expanded"
|
| 50 |
-
)
|
| 51 |
|
| 52 |
# Sidebar for navigation and controls
|
| 53 |
st.sidebar.title("Controls & Settings")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
|
| 3 |
+
# Set page config with custom title and layout - DEBE SER EL PRIMER COMANDO STREAMLIT
|
| 4 |
+
st.set_page_config(
|
| 5 |
+
page_title="Advanced Face & Feature Detection",
|
| 6 |
+
page_icon="👤",
|
| 7 |
+
layout="wide",
|
| 8 |
+
initial_sidebar_state="expanded"
|
| 9 |
+
)
|
| 10 |
+
|
| 11 |
+
# Importaciones después de set_page_config
|
| 12 |
import cv2
|
| 13 |
import numpy as np
|
| 14 |
from PIL import Image
|
|
|
|
| 18 |
import os
|
| 19 |
import time
|
| 20 |
import urllib.request
|
| 21 |
+
import pandas as pd
|
| 22 |
+
import json
|
| 23 |
import matplotlib.pyplot as plt
|
| 24 |
import pickle
|
| 25 |
from sklearn.metrics.pairwise import cosine_similarity # type: ignore
|
| 26 |
+
|
| 27 |
+
# Importar módulos opcionales que pueden no estar disponibles en todos los entornos
|
| 28 |
+
try:
|
| 29 |
+
import av
|
| 30 |
+
from streamlit_webrtc import webrtc_streamer, VideoProcessorBase, RTCConfiguration, WebRtcMode
|
| 31 |
+
WEBRTC_AVAILABLE = True
|
| 32 |
+
except ImportError:
|
| 33 |
+
WEBRTC_AVAILABLE = False
|
| 34 |
+
st.warning("WebRTC components are not available. Real-time camera features will be disabled.")
|
| 35 |
|
| 36 |
# Importar las utilidades para la base de datos de rostros
|
| 37 |
try:
|
|
|
|
| 58 |
|
| 59 |
# Función principal que encapsula toda la aplicación
|
| 60 |
def main():
|
| 61 |
+
# La configuración de la página ya se ha hecho al inicio del script, eliminar de aquí
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
# Sidebar for navigation and controls
|
| 64 |
st.sidebar.title("Controls & Settings")
|