repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
Scrapegraph-ai | examples/code_generator_graph/ollama/code_generator_graph_ollama.py | .py | """
Basic example of scraping pipeline using Code Generator with schema
"""
from typing import List
from dotenv import load_dotenv
from pydantic import BaseModel, Field
from scrapegraphai.graphs import CodeGeneratorGraph
load_dotenv()
# ************************************************
# Define the output schema fo... | 66 | 1,589 |
Scrapegraph-ai | examples/smart_scraper_graph/openai/smart_scraper_lite_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperLiteGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
graph_config = {
"llm": {
"api_key": os.getenv("OPENAI_API_KEY"),
... | 35 | 732 |
Scrapegraph-ai | examples/smart_scraper_graph/openai/smart_scraper_multi_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperMultiGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# ************************************... | 42 | 962 |
Scrapegraph-ai | examples/smart_scraper_graph/openai/smart_scraper_multi_concat_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperMultiConcatGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# ******************************... | 41 | 973 |
Scrapegraph-ai | examples/smart_scraper_graph/openai/smart_scraper_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configuration for th... | 48 | 1,158 |
Scrapegraph-ai | examples/smart_scraper_graph/openai/smart_scraper_schema_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper with schema
"""
import os
from typing import List
from dotenv import load_dotenv
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SmartScraperGraph
load_dotenv()
# ************************************************
# Define the output sc... | 57 | 1,359 |
Scrapegraph-ai | examples/smart_scraper_graph/openai/smart_scraper_multi_lite_openai.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperMultiLiteGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configurati... | 48 | 1,224 |
Scrapegraph-ai | examples/smart_scraper_graph/nvidia/smart_scraper_nvidia.py | .py | """
Basic example of scraping pipeline using SmartScraper with NVIDIA
"""
import json
import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
load_dotenv()
# ************************************************
# Define the configur... | 49 | 1,219 |
Scrapegraph-ai | examples/smart_scraper_graph/scrapegraphai/smartscraper_scrapegraphai_v3.py | .py | """
Extract structured data using the scrapegraph-py v3 API (PR #84).
Uses ScrapeGraphAI client + ExtractRequest model + ApiResult wrapper.
"""
import json
import os
from dotenv import load_dotenv
from scrapegraph_py import ExtractRequest, ScrapeGraphAI
load_dotenv()
api_key = os.getenv("SGAI_API_KEY") or os.getenv... | 30 | 822 |
Scrapegraph-ai | examples/smart_scraper_graph/scrapegraphai/smartscraper_scrapegraphai.py | .py | """
Extract structured data from a webpage using scrapegraph-py v2 API.
Replaces the old smartscraper() call with extract().
"""
import json
import os
from dotenv import load_dotenv
from scrapegraph_py import Client
load_dotenv()
api_key = os.getenv("SCRAPEGRAPH_API_KEY")
if not api_key:
raise ValueError("SCRAP... | 24 | 586 |
Scrapegraph-ai | examples/smart_scraper_graph/ollama/smart_scraper_ollama.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_conf... | 41 | 1,164 |
Scrapegraph-ai | examples/smart_scraper_graph/ollama/smart_scraper_multi_ollama.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
from scrapegraphai.graphs import SmartScraperMultiGraph
# ************************************************
# Define the configuration for the graph
# ************************************************
graph_config = {
"llm": {
"model... | 36 | 938 |
Scrapegraph-ai | examples/smart_scraper_graph/ollama/smart_scraper_multi_lite_ollama.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
from scrapegraphai.graphs import SmartScraperMultiLiteGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the graph
# **************************************... | 43 | 1,222 |
Scrapegraph-ai | examples/smart_scraper_graph/ollama/smart_scraper_lite_ollama.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
from scrapegraphai.graphs import SmartScraperLiteGraph
from scrapegraphai.utils import prettify_exec_info
graph_config = {
"llm": {
"model": "ollama/llama3.1",
"temperature": 0,
"base_url": "http://localhost:11434"... | 32 | 702 |
Scrapegraph-ai | examples/smart_scraper_graph/ollama/smart_scraper_schema_ollama.py | .py | """
Basic example of scraping pipeline using SmartScraper with schema
"""
import json
from pydantic import BaseModel, Field
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info
# ************************************************
# Define the configuration for the gra... | 51 | 1,402 |
Scrapegraph-ai | examples/smart_scraper_graph/ollama/smart_scraper_multi_concat_ollama.py | .py | """
Basic example of scraping pipeline using SmartScraper
"""
import json
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperMultiConcatGraph
load_dotenv()
# ************************************************
# Define the configuration for the graph
# ****************************************... | 40 | 996 |
insightface | python-package/setup.py | .py | #!/usr/bin/env python
import os
import io
import re
import sys
import subprocess
import platform
import logging
from setuptools import setup, find_namespace_packages
FACE3D_BUILD_FLAG = '--with-face3d'
def strtobool_env(value):
return str(value).strip().lower() in ('1', 'true', 'yes', 'on')
build_face3d = str... | 185 | 5,952 |
insightface | python-package/insightface/__init__.py | .py | # coding: utf-8
# pylint: disable=wrong-import-position
"""InsightFace: A Face Analysis Toolkit."""
from __future__ import absolute_import
try:
#import mxnet as mx
import onnxruntime
except ImportError:
raise ImportError(
"Unable to import dependency onnxruntime. "
)
__version__ = '1.0.1'
fro... | 21 | 423 |
insightface | python-package/insightface/model_zoo/retinaface.py | .py | # -*- coding: utf-8 -*-
# @Organization : insightface.ai
# @Author : Jia Guo
# @Time : 2021-09-18
# @Function :
from __future__ import division
import datetime
import numpy as np
import onnx
import onnxruntime
import os
import os.path as osp
import cv2
import sys
def softmax(z):
assert len(... | 369 | 13,965 |
insightface | python-package/insightface/model_zoo/inswapper.py | .py | import time
import numpy as np
import onnxruntime
import cv2
import onnx
from onnx import numpy_helper
from ..utils import face_align
class INSwapper():
def __init__(self, model_file=None, session=None):
self.model_file = model_file
self.session = session
model = onnx.load(self.model_fil... | 106 | 4,649 |
insightface | python-package/insightface/model_zoo/model_store.py | .py | """
This code file mainly comes from https://github.com/dmlc/gluon-cv/blob/master/gluoncv/model_zoo/model_store.py
"""
from __future__ import print_function
__all__ = ['get_model_file']
import os
import zipfile
import glob
from ..utils import download, check_sha1
_model_sha1 = {
name: checksum
for checksum, ... | 103 | 3,117 |
insightface | python-package/insightface/model_zoo/arcface_onnx.py | .py | # -*- coding: utf-8 -*-
# @Organization : insightface.ai
# @Author : Jia Guo
# @Time : 2021-05-04
# @Function :
from __future__ import division
import numpy as np
import cv2
import onnx
import onnxruntime
from ..utils import face_align
__all__ = [
'ArcFaceONNX',
]
class ArcFaceONNX:
d... | 93 | 3,111 |
insightface | python-package/insightface/model_zoo/scrfd.py | .py | # -*- coding: utf-8 -*-
# @Organization : insightface.ai
# @Author : Jia Guo
# @Time : 2021-05-04
# @Function :
from __future__ import division
import datetime
import numpy as np
import onnx
import onnxruntime
import os
import os.path as osp
import cv2
import sys
DEFAULT_DET_SIZES = [(128, 128)... | 425 | 16,065 |
insightface | python-package/insightface/model_zoo/model_zoo.py | .py | # -*- coding: utf-8 -*-
# @Organization : insightface.ai
# @Author : Jia Guo
# @Time : 2021-05-04
# @Function :
import os
import os.path as osp
import glob
import onnxruntime
from .arcface_onnx import *
from .retinaface import *
from .scrfd import *
from .landmark import *
from .attribute import... | 98 | 3,552 |
insightface | python-package/insightface/model_zoo/landmark.py | .py | # -*- coding: utf-8 -*-
# @Organization : insightface.ai
# @Author : Jia Guo
# @Time : 2021-05-04
# @Function :
from __future__ import division
import numpy as np
import cv2
import onnx
import onnxruntime
from ..utils import face_align
from ..utils import transform
from ..data import get_object
... | 115 | 4,198 |
insightface | python-package/insightface/model_zoo/attribute.py | .py | # -*- coding: utf-8 -*-
# @Organization : insightface.ai
# @Author : Jia Guo
# @Time : 2021-06-19
# @Function :
from __future__ import division
import numpy as np
import cv2
import onnx
import onnxruntime
from ..utils import face_align
__all__ = [
'Attribute',
]
class Attribute:
def _... | 95 | 3,351 |
insightface | python-package/insightface/gui/app.py | .py | """Application bootstrap for InsightFace Evaluation Studio."""
from __future__ import annotations
import os
import sys
from dataclasses import dataclass
from typing import Iterable, Optional
from pathlib import Path
from .core.config import AppConfig, load_config, save_config
from .core.face_engine import FaceEngin... | 163 | 5,195 |
insightface | python-package/insightface/gui/__main__.py | .py | """Command line entry point for InsightFace Evaluation Studio."""
from __future__ import annotations
import argparse
import sys
from . import __version__
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="InsightFace Evaluation Studio")
parser.add_argument("--works... | 47 | 1,625 |
insightface | python-package/insightface/gui/__init__.py | .py | """InsightFace Evaluation Studio.
The GUI package is intentionally import-light. Importing ``insightface.gui``
does not require PySide6; GUI dependencies are loaded by the entry point.
"""
__version__ = "1.0.1"
APP_NAME = "InsightFace Evaluation Studio"
APP_DISPLAY_NAME = "InsightFace Evaluation Studio v1.0.1"
__al... | 13 | 374 |
insightface | python-package/insightface/gui/page_registry.py | .py | """Lazy page registry used by mode-based navigation."""
from __future__ import annotations
from PySide6.QtWidgets import QWidget
from .pages.album_page import AlbumPage
from .pages.album_people_page import AlbumPeoplePage
from .pages.batch_processing_page import BatchProcessingPage
from .pages.camera_recognition_pag... | 110 | 4,798 |
insightface | python-package/insightface/gui/main_window.py | .py | """Main window, mode navigation, and task orchestration."""
from __future__ import annotations
import inspect
from pathlib import Path
from typing import Callable
from PySide6.QtCore import QObject, QRunnable, QSize, Qt, QThreadPool, QTimer, QUrl, Signal, Slot
from PySide6.QtGui import QAction, QDesktopServices, QFo... | 617 | 27,011 |
insightface | python-package/insightface/gui/resources.py | .py | """Application resources and desktop metadata helpers."""
from __future__ import annotations
import sys
from pathlib import Path
from .core.constants import (
APP_DOMAIN,
APP_ID,
APP_NAME,
APP_ORGANIZATION,
APP_PROCESS_NAME,
APP_VERSION,
)
ASSET_DIR = Path(__file__).resolve().parent / "asset... | 105 | 2,738 |
insightface | python-package/insightface/gui/widgets/progress_dialog.py | .py | """Cancelable progress dialog."""
from __future__ import annotations
from PySide6.QtWidgets import QProgressDialog
from PySide6.QtCore import Qt
class StudioProgressDialog(QProgressDialog):
def __init__(self, title: str, parent=None):
super().__init__("", "Cancel", 0, 100, parent)
self.setWindow... | 21 | 649 |
insightface | python-package/insightface/gui/widgets/table_utils.py | .py | """Table layout helpers for dense desktop review pages."""
from __future__ import annotations
from PySide6.QtCore import QEvent, QObject, QTimer
from PySide6.QtWidgets import QAbstractItemView, QAbstractScrollArea, QHeaderView, QTableWidget
class _ProportionalTableSizer(QObject):
def __init__(self, table: QTabl... | 75 | 3,011 |
insightface | python-package/insightface/gui/widgets/metric_card.py | .py | """Small metric display."""
from __future__ import annotations
from PySide6.QtWidgets import QFrame, QLabel, QVBoxLayout
class MetricCard(QFrame):
def __init__(self, title: str, value: str = "0", parent=None):
super().__init__(parent)
self.setFrameShape(QFrame.StyledPanel)
self.title_lab... | 21 | 672 |
insightface | python-package/insightface/gui/widgets/threshold_slider.py | .py | """Threshold slider widget."""
from __future__ import annotations
from PySide6.QtCore import Signal
from PySide6.QtWidgets import QHBoxLayout, QLabel, QSlider, QWidget
from PySide6.QtCore import Qt
from ..core.constants import DEFAULT_THRESHOLD
class ThresholdSlider(QWidget):
valueChanged = Signal(float)
... | 39 | 1,199 |
insightface | python-package/insightface/gui/widgets/face_table.py | .py | """Table helpers for face/search results."""
from __future__ import annotations
from typing import Iterable, Mapping
from PySide6.QtWidgets import QTableWidget, QTableWidgetItem
from .table_utils import configure_table_columns, refresh_table_columns
class FaceTable(QTableWidget):
def set_rows(self, rows: Iter... | 23 | 824 |
insightface | python-package/insightface/gui/widgets/upload_preview.py | .py | """Clickable drag-and-drop preview input for local images and videos."""
from __future__ import annotations
from pathlib import Path
from typing import Iterable, Optional
import numpy as np
from PySide6.QtCore import QEvent, Qt, Signal
from PySide6.QtGui import QCursor
from PySide6.QtWidgets import (
QFileDialog... | 237 | 8,553 |
insightface | python-package/insightface/gui/widgets/image_viewer.py | .py | """Zoomable image viewer with face overlays."""
from __future__ import annotations
from typing import Any, Iterable, List, Optional
import numpy as np
from PySide6.QtCore import QPointF, QRectF, Qt, Signal
from PySide6.QtGui import QColor, QImage, QPainter, QPen, QPixmap
from PySide6.QtWidgets import QGraphicsPixmap... | 118 | 4,951 |
insightface | python-package/insightface/gui/widgets/person_card.py | .py | """Compact person/cluster card."""
from __future__ import annotations
from PySide6.QtWidgets import QFrame, QLabel, QPushButton, QVBoxLayout
from ..core.tooltips import set_button_tooltip
class PersonCard(QFrame):
def __init__(self, title: str, subtitle: str = "", parent=None):
super().__init__(parent)... | 23 | 730 |
insightface | python-package/insightface/gui/widgets/drop_input.py | .py | """Reusable drag-and-drop file/folder input."""
from __future__ import annotations
from pathlib import Path
from typing import Iterable, Sequence
from PySide6.QtCore import QEvent, Qt, Signal
from PySide6.QtGui import QCursor
from PySide6.QtWidgets import (
QFileDialog,
QFrame,
QHBoxLayout,
QLabel,
... | 246 | 9,509 |
insightface | python-package/insightface/gui/widgets/face_overlay.py | .py | """Overlay formatting helpers."""
from __future__ import annotations
def face_label(name: str = "Unknown", similarity: float | None = None) -> str:
if similarity is None:
return name or "Unknown"
return f"{name or 'Unknown'} {similarity:.2f}"
| 10 | 262 |
insightface | python-package/insightface/gui/core/clustering.py | .py | """Face embedding clustering helpers."""
from __future__ import annotations
from typing import Dict, Iterable, List
import numpy as np
from .recognition import cosine_similarity, normalize_embedding
def cluster_embeddings(
embeddings: Iterable[np.ndarray],
threshold: float = 0.72,
min_samples: int = 2... | 66 | 2,192 |
insightface | python-package/insightface/gui/core/model_downloads.py | .py | """Manual model download catalog and helpers.
The GUI never downloads models automatically. Users must open Model Downloads,
refresh URLs, and explicitly start a download.
"""
from __future__ import annotations
import json
import os
import shutil
import time
import urllib.error
import urllib.request
import zipfile
f... | 357 | 13,020 |
insightface | python-package/insightface/gui/core/logging.py | .py | """Logging setup."""
from __future__ import annotations
import logging
from pathlib import Path
def setup_logging(log_dir: str | Path) -> Path:
path = Path(log_dir).expanduser()
path.mkdir(parents=True, exist_ok=True)
log_file = path / "app.log"
logger = logging.getLogger("insightface.gui")
logg... | 26 | 822 |
insightface | python-package/insightface/gui/core/utils.py | .py | """General utilities for image and file handling."""
from __future__ import annotations
import hashlib
import json
import os
from io import BytesIO
from datetime import datetime
from pathlib import Path
from typing import Any, Iterable, Optional
import numpy as np
def utc_now_iso() -> str:
return datetime.utcn... | 150 | 4,517 |
insightface | python-package/insightface/gui/core/swap.py | .py | """Face swap model wrapper."""
from __future__ import annotations
from pathlib import Path
from typing import Optional
import numpy as np
class GFPGANRestorer:
"""Small ONNXRuntime wrapper for GFPGAN 512x512 face restoration."""
def __init__(self, model_path: str = "", providers: Optional[list[str]] = Non... | 117 | 4,599 |
insightface | python-package/insightface/gui/core/navigation.py | .py | """Mode-based navigation specification for the desktop GUI."""
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
class AppMode(str, Enum):
FACE_VERIFICATION = "face_verification"
ALBUM_MANAGEMENT = "album_management"
FACE_SWAP = "face_swap"
ENTERPRISE_EVALUAT... | 92 | 2,943 |
insightface | python-package/insightface/gui/core/reporting.py | .py | """Enterprise evaluation report generation."""
from __future__ import annotations
import html
import sys
from pathlib import Path
from typing import Any, Dict, Iterable, List, Sequence, Tuple
from .i18n import effective_language
from .models import EvaluationResult
from .utils import safe_json_dumps, timestamp_for_f... | 761 | 37,506 |
insightface | python-package/insightface/gui/core/evaluation.py | .py | """No-code enterprise evaluation routines."""
from __future__ import annotations
import csv
import math
import platform
import time
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional
import numpy as np
from .constants import DEFAULT_LICENSE_STATUS, DEFAULT... | 1,166 | 50,337 |
insightface | python-package/insightface/gui/core/storage.py | .py | """SQLite storage for local people, media, embeddings, and reports."""
from __future__ import annotations
import json
import sqlite3
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Dict, Iterable, Iterator, List, Optional
import numpy as np
from .logging import get_logger
from... | 738 | 29,323 |
insightface | python-package/insightface/gui/core/models.py | .py | """Dataclasses used by the GUI core."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional
import numpy as np
@dataclass
class FaceRecord:
bbox: List[float]
kps: Optional[List[List[float]]]
det_score: float
embedding: Optional[np... | 120 | 3,604 |
insightface | python-package/insightface/gui/core/i18n.py | .py | """Lightweight runtime localization for the desktop GUI."""
from __future__ import annotations
import locale
from dataclasses import dataclass
from typing import Any
from PySide6.QtCore import QLocale, QObject, Qt
from PySide6.QtGui import QAction
from PySide6.QtWidgets import (
QAbstractButton,
QComboBox,
... | 3,079 | 227,365 |
insightface | python-package/insightface/gui/core/constants.py | .py | """Shared constants and product copy."""
from __future__ import annotations
APP_NAME = "InsightFace Evaluation Studio"
APP_VERSION = "1.0.1"
APP_ORGANIZATION = "InsightFace"
APP_DOMAIN = "insightface.ai"
APP_ID = "ai.insightface.evaluationstudio"
APP_PROCESS_NAME = APP_NAME
WINDOW_TITLE = "InsightFace Evaluation Stud... | 49 | 1,631 |
insightface | python-package/insightface/gui/core/recognition.py | .py | """Embedding normalization, comparison, and gallery search."""
from __future__ import annotations
from collections import defaultdict
from typing import Any, Dict, Iterable, List, Optional
import numpy as np
from .constants import DEFAULT_THRESHOLD
from .models import SearchResult
def normalize_embedding(embeddin... | 119 | 4,166 |
insightface | python-package/insightface/gui/core/video.py | .py | """Simple video helpers for local processing."""
from __future__ import annotations
from pathlib import Path
from typing import Iterator, Tuple
import numpy as np
def timestamp_hhmmss(timestamp_ms: int) -> str:
seconds = timestamp_ms // 1000
h = seconds // 3600
m = (seconds % 3600) // 60
s = second... | 52 | 1,348 |
insightface | python-package/insightface/gui/core/links.py | .py | """External link helpers for GUI-origin attribution."""
from __future__ import annotations
from urllib.parse import parse_qsl, urlencode, urlsplit, urlunsplit
from PySide6.QtCore import QUrl
from PySide6.QtGui import QDesktopServices
INSIGHTFACE_LINK_HOSTS = {"insightface.ai", "www.insightface.ai"}
GUI_UTM_SOURCE =... | 41 | 1,539 |
insightface | python-package/insightface/gui/core/tooltips.py | .py | """Shared button tooltip helpers."""
from __future__ import annotations
import re
from PySide6.QtWidgets import QAbstractButton, QWidget
BUTTON_TOOLTIPS = {
"Add Folder": "Add an album folder to the import list.",
"Add Person": "Create a new person entry in the local People Library.",
"Add as New Perso... | 109 | 5,651 |
insightface | python-package/insightface/gui/core/exporters.py | .py | """Export helpers for JSON, CSV, Markdown, HTML, and annotated images."""
from __future__ import annotations
import csv
import json
from pathlib import Path
from typing import Any, Iterable, Mapping
from .utils import safe_json_dumps, save_image
def export_json(path: str | Path, data: Any) -> Path:
out = Path(... | 52 | 1,624 |
insightface | python-package/insightface/gui/core/face_engine.py | .py | """InsightFace runtime wrapper used by the GUI."""
from __future__ import annotations
import glob
import os
import threading
import time
from pathlib import Path
from typing import Any, Dict, Iterable, List, Optional
import numpy as np
from .constants import AUTO_DET_SIZES, DEFAULT_DET_SIZE, DEFAULT_MODEL_NAME, DEF... | 421 | 17,809 |
insightface | python-package/insightface/gui/core/camera.py | .py | """Camera availability helpers."""
from __future__ import annotations
from typing import List
def list_camera_indices(max_indices: int = 4) -> List[int]:
try:
import cv2
except Exception:
return []
indices = []
for idx in range(max_indices):
cap = cv2.VideoCapture(idx)
... | 20 | 414 |
insightface | python-package/insightface/gui/core/paths.py | .py | """Workspace and filesystem helpers."""
from __future__ import annotations
import os
from pathlib import Path
from typing import Dict
def default_workspace() -> Path:
return Path.home() / ".insightface" / "gui"
def default_config_path() -> Path:
return default_workspace() / "config.json"
def expand_path... | 45 | 1,251 |
insightface | python-package/insightface/gui/core/quality.py | .py | """Heuristic face quality scoring."""
from __future__ import annotations
from typing import Iterable, List, Optional, Tuple
import numpy as np
def _to_gray(image: np.ndarray) -> np.ndarray:
arr = np.asarray(image)
if arr.ndim == 2:
return arr.astype(np.float32)
if arr.shape[2] >= 3:
ret... | 104 | 3,487 |
insightface | python-package/insightface/gui/core/config.py | .py | """Configuration loading and saving."""
from __future__ import annotations
import json
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import Any, Dict, Optional
from .constants import (
DEFAULT_DET_SIZE,
DEFAULT_LICENSE_STATUS,
DEFAULT_MODEL_NAME,
DEFAULT_PROVIDER,
... | 124 | 4,407 |
insightface | python-package/insightface/gui/core/licensing.py | .py | """License center helpers."""
from __future__ import annotations
from pathlib import Path
from typing import Dict
from .constants import COMMERCIAL_NOTICE, LICENSE_NOTICE, RESPONSIBLE_USE_NOTICE
def find_license_text(start: str | Path) -> str:
root = Path(start).resolve()
candidates = [root / "LICENSE", ro... | 47 | 1,553 |
insightface | python-package/insightface/gui/core/theme.py | .py | """Qt stylesheet helpers for the desktop GUI."""
from __future__ import annotations
from dataclasses import dataclass
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication
@dataclass(frozen=True)
class ThemeOption:
value: str
label: str
description: str
THEME_OPTIONS = [
ThemeO... | 623 | 20,571 |
insightface | python-package/insightface/gui/pages/settings_page.py | .py | """Application settings page."""
from __future__ import annotations
import json
from pathlib import Path
from PySide6.QtCore import QUrl
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QCheckBox, QComboBox, QDoubleSpinBox, QFormLayout, QLineEdit, QSpinBox
from ..core.config import AppConfig... | 114 | 5,404 |
insightface | python-package/insightface/gui/pages/people_library_page.py | .py | """People library management page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import QEvent, QSize, Qt, Signal
from PySide6.QtGui import QCursor, QIcon, QPixmap
from PySide6.QtWidgets import (
QFileDialog,
QFrame,
QInputDialog,
QLabel,
QMenu,
QPushButto... | 362 | 14,988 |
insightface | python-package/insightface/gui/pages/compare_page.py | .py | """1:1 face compare page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtWidgets import QSplitter, QTextEdit, QWidget, QVBoxLayout
from PySide6.QtCore import Qt
from ..core.exporters import export_json, export_markdown
from ..core.utils import read_image, timestamp_for_filename
from .... | 196 | 7,811 |
insightface | python-package/insightface/gui/pages/model_settings_page.py | .py | """Model settings page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import Qt
from PySide6.QtGui import QColor, QBrush
from PySide6.QtWidgets import QCheckBox, QComboBox, QFormLayout, QLabel, QLineEdit, QTextEdit
from ..core.config import save_config
from ..core.face_engine im... | 235 | 11,681 |
insightface | python-package/insightface/gui/pages/reports_page.py | .py | """Reports page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import QUrl
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QTableWidget, QTableWidgetItem
from ..core.exporters import export_csv
from ..core.models import EvaluationResult
from ..core.repor... | 78 | 3,805 |
insightface | python-package/insightface/gui/pages/verification_page.py | .py | """Combined Query and Gallery verification workflow."""
from __future__ import annotations
from pathlib import Path
import numpy as np
from PySide6.QtCore import QDir, QEvent, QSize, Qt, QUrl, Signal
from PySide6.QtGui import QCursor, QDesktopServices, QIcon, QPixmap
from PySide6.QtWidgets import (
QComboBox,
... | 697 | 28,882 |
insightface | python-package/insightface/gui/pages/enterprise_eval_page.py | .py | """Single-page enterprise 1:1 and 1:N evaluation workflow."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import QEvent, Qt
from PySide6.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QDialogButtonBox,
QFrame,
QGridLayout,
QHBoxLayout,
QLabel,
... | 1,256 | 46,986 |
insightface | python-package/insightface/gui/pages/multiface_photo_page.py | .py | """Multi-face photo recognition page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QSplitter, QTableWidget, QTableWidgetItem, QVBoxLayout, QWidget
from ..core.exporters import export_annotated_image, export_csv, export_json
from ..core.ut... | 132 | 6,426 |
insightface | python-package/insightface/gui/pages/video_search_page.py | .py | """Video person search page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtWidgets import QComboBox, QLabel, QSpinBox, QTableWidget, QTableWidgetItem
from ..core.exporters import export_csv
from ..core.recognition import search_gallery
from ..core.utils import save_image, timestamp_f... | 110 | 5,727 |
insightface | python-package/insightface/gui/pages/placeholder_page.py | .py | """Reusable placeholder and commercial next-steps pages."""
from __future__ import annotations
from PySide6.QtWidgets import QLabel, QPushButton
from ..core.tooltips import set_button_tooltip
from .base import BasePage
class PlaceholderPage(BasePage):
def __init__(
self,
context,
title:... | 74 | 2,965 |
insightface | python-package/insightface/gui/pages/license_center_page.py | .py | """License Center page."""
from __future__ import annotations
from PySide6.QtWidgets import QLabel, QTableWidget, QTableWidgetItem
from ..core.i18n import tr
from ..core.links import open_insightface_url
from ..core.licensing import allowed_usage_summary
from ..core.constants import APP_VERSION
from ..widgets.table_... | 71 | 3,087 |
insightface | python-package/insightface/gui/pages/album_people_page.py | .py | """Album people clustering page."""
from __future__ import annotations
from collections import defaultdict
from pathlib import Path
from PySide6.QtWidgets import QLabel, QDoubleSpinBox, QTableWidget, QTableWidgetItem
from ..core.clustering import cluster_embeddings_dbscan
from ..core.exporters import export_csv
fro... | 99 | 4,835 |
insightface | python-package/insightface/gui/pages/dashboard_page.py | .py | """Dashboard page."""
from __future__ import annotations
from PySide6.QtWidgets import QGridLayout, QPushButton, QWidget
from ..core.constants import LOCAL_PROCESSING_NOTICE, SUBTITLE
from ..core.tooltips import set_button_tooltip
from ..widgets.metric_card import MetricCard
from .base import BasePage
class Dashbo... | 60 | 2,763 |
insightface | python-package/insightface/gui/pages/album_page.py | .py | """Single-page album import, clustering, and review workflow."""
from __future__ import annotations
from collections import defaultdict
from io import BytesIO
from pathlib import Path
import numpy as np
from PySide6.QtCore import QEvent, QSize, Qt, QUrl, Signal
from PySide6.QtGui import QCursor, QDesktopServices, QI... | 628 | 26,779 |
insightface | python-package/insightface/gui/pages/camera_recognition_page.py | .py | """Camera recognition page."""
from __future__ import annotations
from PySide6.QtWidgets import QLabel, QSpinBox
from ..core.camera import list_camera_indices
from ..core.constants import RESPONSIBLE_USE_NOTICE
from ..widgets.threshold_slider import ThresholdSlider
from .base import BasePage
class CameraRecognitio... | 33 | 1,746 |
insightface | python-package/insightface/gui/pages/mode_dashboards.py | .py | """Mode-specific dashboard pages."""
from __future__ import annotations
from PySide6.QtWidgets import QGridLayout, QLabel, QPushButton, QWidget
from ..core.constants import LOCAL_PROCESSING_NOTICE, RESPONSIBLE_USE_NOTICE
from ..core.tooltips import set_button_tooltip
from .base import BasePage
class ModeDashboardP... | 117 | 5,589 |
insightface | python-package/insightface/gui/pages/face_search_page.py | .py | """1:N face search page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import QSize, Qt
from PySide6.QtGui import QIcon, QPixmap
from PySide6.QtWidgets import QInputDialog, QSplitter, QTableWidget, QTableWidgetItem, QVBoxLayout, QWidget
from ..core.exporters import export_csv, e... | 180 | 8,161 |
insightface | python-package/insightface/gui/pages/batch_processing_page.py | .py | """Batch folder processing page."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtWidgets import QCheckBox, QLabel, QProgressBar, QSpinBox, QTableWidget, QTableWidgetItem
from ..core.exporters import export_csv, export_json
from ..core.utils import list_images, read_image, save_image, t... | 118 | 6,664 |
insightface | python-package/insightface/gui/pages/face_swap_page.py | .py | """Source + Target face swap page for images and videos."""
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
import numpy as np
from PySide6.QtCore import QEvent, Qt, QUrl
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QLabel, QSplitter, QVBoxLay... | 319 | 14,252 |
insightface | python-package/insightface/gui/pages/base.py | .py | """Base page helpers."""
from __future__ import annotations
from pathlib import Path
from typing import Callable, Optional
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QFileDialog,
QFrame,
QHBoxLayout,
QLabel,
QMessageBox,
QPushButton,
QVBoxLayout,
QWidget,
)
from ..... | 115 | 4,079 |
insightface | python-package/insightface/gui/pages/model_download_page.py | .py | """Manual GitHub release model downloads."""
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import QUrl
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QAbstractItemView, QFrame, QLabel, QTableWidget, QTableWidgetItem, QVBoxLayout
from ..core.config import s... | 187 | 7,580 |
insightface | python-package/insightface/gui/dialogs/settings_dialog.py | .py | """Application settings dialog."""
from __future__ import annotations
from PySide6.QtCore import Signal
from PySide6.QtWidgets import QComboBox, QDialog, QDialogButtonBox, QFormLayout, QLabel, QVBoxLayout
from ..core.config import save_config
from ..core.i18n import LANGUAGE_OPTIONS, apply_translations, normalize_la... | 76 | 3,299 |
insightface | python-package/insightface/gui/dialogs/license_dialog.py | .py | """License dialog."""
from __future__ import annotations
from PySide6.QtWidgets import QDialog, QLabel, QVBoxLayout
from ..core.i18n import tr
from ..pages.license_center_page import LicenseCenterPage
class LicenseDialog(QDialog):
def __init__(self, context, parent=None):
super().__init__(parent)
... | 28 | 924 |
insightface | python-package/insightface/gui/dialogs/model_manager_dialog.py | .py | """Model runtime and download manager dialog."""
from __future__ import annotations
from PySide6.QtCore import Signal
from PySide6.QtWidgets import QDialog, QLabel, QTabWidget, QVBoxLayout
from ..core.i18n import tr
from ..pages.model_download_page import ModelDownloadPage
from ..pages.model_settings_page import Mod... | 75 | 2,767 |
insightface | python-package/insightface/utils/transform.py | .py | import cv2
import math
import numpy as np
from skimage import transform as trans
def transform(data, center, output_size, scale, rotation):
scale_ratio = scale
rot = float(rotation) * np.pi / 180.0
#translation = (output_size/2-center[0]*scale_ratio, output_size/2-center[1]*scale_ratio)
t1 = trans.Sim... | 117 | 3,379 |
insightface | python-package/insightface/utils/filesystem.py | .py | """
This code file mainly comes from https://github.com/dmlc/gluon-cv/blob/master/gluoncv/utils/filesystem.py
"""
import os
import os.path as osp
import errno
def get_model_dir(name, root='~/.insightface'):
root = os.path.expanduser(root)
model_dir = osp.join(root, 'models', name)
return model_dir
def ma... | 158 | 4,250 |
insightface | python-package/insightface/utils/storage.py | .py |
import os
import os.path as osp
import zipfile
from .download import download_file
BASE_REPO_URL = 'https://github.com/deepinsight/insightface/releases/download/v0.7'
def download(sub_dir, name, force=False, root='~/.insightface'):
_root = os.path.expanduser(root)
dir_path = os.path.join(_root, sub_dir, name... | 53 | 1,891 |
insightface | python-package/insightface/utils/download.py | .py | """
This code file mainly comes from https://github.com/dmlc/gluon-cv/blob/master/gluoncv/utils/download.py
"""
import os
import hashlib
import requests
from tqdm import tqdm
def check_sha1(filename, sha1_hash):
"""Check whether the sha1 hash of the file content matches the expected hash.
Parameters
-----... | 96 | 3,360 |
insightface | python-package/insightface/utils/face_align.py | .py | import cv2
import numpy as np
from skimage import transform as trans
arcface_dst = np.array(
[[38.2946, 51.6963], [73.5318, 51.5014], [56.0252, 71.7366],
[41.5493, 92.3655], [70.7299, 92.2041]],
dtype=np.float32)
def estimate_norm(lmk, image_size=112,mode='arcface'):
assert lmk.shape == (5, 2)
a... | 104 | 3,356 |
insightface | python-package/insightface/utils/constant.py | .py |
DEFAULT_MP_NAME = 'buffalo_l'
| 4 | 32 |
insightface | python-package/insightface/data/pickle_object.py | .py | import sys
import os
import os.path as osp
from pathlib import Path
import pickle
def get_object(name):
if getattr(sys, 'frozen', False):
base_dir = sys._MEIPASS
else:
base_dir = Path(__file__).parent.absolute()
objects_dir = osp.join(base_dir, 'objects')
if not name.endswith('.pkl'):... | 28 | 587 |
insightface | python-package/insightface/data/image.py | .py | import cv2
import os
import os.path as osp
from pathlib import Path
class ImageCache:
data = {}
def get_image(name, to_rgb=False, use_cache=True):
key = (name, to_rgb)
if key in ImageCache.data:
return ImageCache.data[key]
images_dir = osp.join(Path(__file__).parent.absolute(), 'images')
e... | 29 | 769 |
insightface | python-package/insightface/data/rec_builder.py | .py | import pickle
import numpy as np
import os
import os.path as osp
import sys
import mxnet as mx
class RecBuilder():
def __init__(self, path, image_size=(112, 112)):
self.path = path
self.image_size = image_size
self.widx = 0
self.wlabel = 0
self.max_label = -1
assert... | 72 | 2,511 |
insightface | python-package/insightface/thirdparty/face3d/morphable_model/morphabel_model.py | .py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import scipy.io as sio
from .. import mesh
from . import fit
from . import load
class MorphabelModel(object):
"""docstring for MorphabelModel
model: nver: number of vertices. ntri:... | 144 | 5,567 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.