Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,13 @@ import platform
|
|
| 10 |
import time
|
| 11 |
from huggingface_hub import hf_hub_download
|
| 12 |
import huggingface_hub
|
| 13 |
-
# import spaces #[uncomment to use ZeroGPU]
|
| 14 |
from diffusers import DiffusionPipeline
|
| 15 |
import torch
|
| 16 |
from torch import nn
|
| 17 |
import torchvision
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
#
|
| 21 |
# To avoid this, check if we are running on a Linux system, and if so load a binary of dlib compiled for x86_64 Linux
|
| 22 |
if(platform.system() == 'Linux'):
|
| 23 |
os.system("pip install ./dlib-19.24.99-cp310-cp310-linux_x86_64.whl")
|
|
@@ -28,12 +27,7 @@ import face_detection
|
|
| 28 |
print(f"took {(time.time() - start_time) / 60} minutes to load face_recognition")
|
| 29 |
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
# def process_image(image : PIL.Image.Image):
|
| 33 |
-
# outputs = face_detection.getCroppedImages(image)
|
| 34 |
-
# # do AI stuff here
|
| 35 |
-
# return gr.Image(outputs[0])
|
| 36 |
-
|
| 37 |
model_repo_id = "CSSE416-final-project/faceRecogModel"
|
| 38 |
weight_file_id = "modelWeights101.bin"
|
| 39 |
|
|
|
|
| 10 |
import time
|
| 11 |
from huggingface_hub import hf_hub_download
|
| 12 |
import huggingface_hub
|
|
|
|
| 13 |
from diffusers import DiffusionPipeline
|
| 14 |
import torch
|
| 15 |
from torch import nn
|
| 16 |
import torchvision
|
| 17 |
|
| 18 |
+
# By default, dlib will be compiled locally when installed via pip, which takes so long it
|
| 19 |
+
# Causes huggingface to time out during the build process.
|
| 20 |
# To avoid this, check if we are running on a Linux system, and if so load a binary of dlib compiled for x86_64 Linux
|
| 21 |
if(platform.system() == 'Linux'):
|
| 22 |
os.system("pip install ./dlib-19.24.99-cp310-cp310-linux_x86_64.whl")
|
|
|
|
| 27 |
print(f"took {(time.time() - start_time) / 60} minutes to load face_recognition")
|
| 28 |
|
| 29 |
|
| 30 |
+
# Change these values to switch the model you are using and the name of the weights file in this model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
model_repo_id = "CSSE416-final-project/faceRecogModel"
|
| 32 |
weight_file_id = "modelWeights101.bin"
|
| 33 |
|