Spaces:
Runtime error
Runtime error
fix app
Browse files- .mypy_cache/3.11/pipelines/data.meta.json +1 -1
- app.py +30 -9
- config/default_config.yaml +4 -0
- requirements.txt +1 -0
.mypy_cache/3.11/pipelines/data.meta.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"data_mtime":1738588084,"dep_lines":[1,1,1,1,1],"dep_prios":[5,30,30,30,30],"dependencies":["builtins","abc","importlib","importlib.machinery","typing"],"hash":"","id":"pipelines.data","ignore_all":true,"interface_hash":"29d474a8c5c73c19fd7dfe8725ca52c7d5c83ff7f40f4faf554856213c926c59","mtime":
|
|
|
|
| 1 |
+
{"data_mtime":1738588084,"dep_lines":[1,1,1,1,1],"dep_prios":[5,30,30,30,30],"dependencies":["builtins","abc","importlib","importlib.machinery","typing"],"hash":"","id":"pipelines.data","ignore_all":true,"interface_hash":"29d474a8c5c73c19fd7dfe8725ca52c7d5c83ff7f40f4faf554856213c926c59","mtime":1738588175,"options":{"allow_redefinition":false,"allow_untyped_globals":false,"always_false":[],"always_true":[],"bazel":false,"check_untyped_defs":false,"disable_bytearray_promotion":false,"disable_error_code":[],"disable_memoryview_promotion":false,"disabled_error_codes":[],"disallow_any_decorated":false,"disallow_any_explicit":false,"disallow_any_expr":false,"disallow_any_generics":false,"disallow_any_unimported":false,"disallow_incomplete_defs":false,"disallow_subclassing_any":false,"disallow_untyped_calls":false,"disallow_untyped_decorators":false,"disallow_untyped_defs":false,"enable_error_code":[],"enabled_error_codes":[],"extra_checks":false,"follow_imports":"normal","follow_imports_for_stubs":false,"ignore_errors":false,"ignore_missing_imports":false,"implicit_optional":false,"implicit_reexport":true,"local_partial_types":false,"mypyc":false,"old_type_inference":false,"platform":"darwin","plugins":[],"strict_concatenate":false,"strict_equality":false,"strict_optional":true,"warn_no_return":true,"warn_return_any":false,"warn_unreachable":false,"warn_unused_ignores":false},"path":"/Users/willwade/GitHub/chaplinDemo/pipelines/data","plugin_data":null,"size":192,"suppressed":[],"version_id":"1.11.2"}
|
app.py
CHANGED
|
@@ -3,12 +3,15 @@ import cv2
|
|
| 3 |
import torch
|
| 4 |
from pipelines.pipeline import InferencePipeline
|
| 5 |
import time
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class ChaplinGradio:
|
| 9 |
def __init__(self):
|
| 10 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 11 |
self.vsr_model = None
|
|
|
|
| 12 |
self.load_models()
|
| 13 |
|
| 14 |
# Video params
|
|
@@ -17,18 +20,36 @@ class ChaplinGradio:
|
|
| 17 |
self.frame_compression = 25
|
| 18 |
self.last_frame_time = time.time()
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
def load_models(self):
|
| 21 |
-
"""Load models using the InferencePipeline with
|
| 22 |
-
|
| 23 |
-
"model": {
|
| 24 |
-
"name": "chaplin_vsr",
|
| 25 |
-
"weights": "models/chaplin_vsr.pth",
|
| 26 |
-
"detector": "mediapipe"
|
| 27 |
-
}
|
| 28 |
-
}
|
| 29 |
|
| 30 |
self.vsr_model = InferencePipeline(
|
| 31 |
-
|
| 32 |
device=self.device,
|
| 33 |
detector="mediapipe",
|
| 34 |
face_track=True
|
|
|
|
| 3 |
import torch
|
| 4 |
from pipelines.pipeline import InferencePipeline
|
| 5 |
import time
|
| 6 |
+
from huggingface_hub import hf_hub_download
|
| 7 |
+
import os
|
| 8 |
|
| 9 |
|
| 10 |
class ChaplinGradio:
|
| 11 |
def __init__(self):
|
| 12 |
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 13 |
self.vsr_model = None
|
| 14 |
+
self.download_models()
|
| 15 |
self.load_models()
|
| 16 |
|
| 17 |
# Video params
|
|
|
|
| 20 |
self.frame_compression = 25
|
| 21 |
self.last_frame_time = time.time()
|
| 22 |
|
| 23 |
+
def download_models(self):
|
| 24 |
+
"""Download required model files from HuggingFace"""
|
| 25 |
+
# Create directories if they don't exist
|
| 26 |
+
os.makedirs("benchmarks/LRS3/models/LRS3_V_WER19.1", exist_ok=True)
|
| 27 |
+
os.makedirs("benchmarks/LRS3/language_models/lm_en_subword", exist_ok=True)
|
| 28 |
+
|
| 29 |
+
# Download VSR model files
|
| 30 |
+
hf_hub_download(repo_id="willwade/LRS3_V_WER19.1",
|
| 31 |
+
filename="model.pth",
|
| 32 |
+
local_dir="benchmarks/LRS3/models/LRS3_V_WER19.1")
|
| 33 |
+
hf_hub_download(repo_id="willwade/LRS3_V_WER19.1",
|
| 34 |
+
filename="model.json",
|
| 35 |
+
local_dir="benchmarks/LRS3/models/LRS3_V_WER19.1")
|
| 36 |
+
|
| 37 |
+
# Download language model files
|
| 38 |
+
hf_hub_download(repo_id="willwade/lm_en_subword",
|
| 39 |
+
filename="model.pth",
|
| 40 |
+
local_dir="benchmarks/LRS3/language_models/lm_en_subword")
|
| 41 |
+
hf_hub_download(repo_id="willwade/lm_en_subword",
|
| 42 |
+
filename="model.json",
|
| 43 |
+
local_dir="benchmarks/LRS3/language_models/lm_en_subword")
|
| 44 |
+
|
| 45 |
+
print("Models downloaded successfully!")
|
| 46 |
+
|
| 47 |
def load_models(self):
|
| 48 |
+
"""Load models using the InferencePipeline with LRS3 config"""
|
| 49 |
+
config_path = "configs/LRS3_V_WER19.1.ini"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
self.vsr_model = InferencePipeline(
|
| 52 |
+
config_path,
|
| 53 |
device=self.device,
|
| 54 |
detector="mediapipe",
|
| 55 |
face_track=True
|
config/default_config.yaml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
name: chaplin_vsr
|
| 3 |
+
weights: models/chaplin_vsr.pth
|
| 4 |
+
detector: mediapipe
|
requirements.txt
CHANGED
|
@@ -5,4 +5,5 @@ opencv-python
|
|
| 5 |
mediapipe
|
| 6 |
numpy
|
| 7 |
torchaudio
|
|
|
|
| 8 |
|
|
|
|
| 5 |
mediapipe
|
| 6 |
numpy
|
| 7 |
torchaudio
|
| 8 |
+
huggingface_hub
|
| 9 |
|