Arrcttacsrks commited on
Commit
eb27e3e
·
verified ·
1 Parent(s): f94caa8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,12 +1,20 @@
 
1
  import cv2
2
  import numpy as np
3
  import onnxruntime as ort
4
  import gradio as gr
5
  from huggingface_hub import hf_hub_download
6
 
7
- # Download the model from Hugging Face Hub
 
 
 
 
 
 
 
8
  model_id = "Arrcttacsrks/netrunner-exe_Insight-Swap-models-onnx"
9
- model_file = hf_hub_download(repo_id=model_id, filename="simswap_512_unoff.onnx")
10
 
11
  def load_and_preprocess_image(image):
12
  img = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
 
1
+ import os
2
  import cv2
3
  import numpy as np
4
  import onnxruntime as ort
5
  import gradio as gr
6
  from huggingface_hub import hf_hub_download
7
 
8
+ # Ensure the Hugging Face token is retrieved from environment variables
9
+ huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
10
+
11
+ # Check if the token is available
12
+ if huggingface_token is None:
13
+ raise ValueError("HUGGINGFACE_TOKEN environment variable not set.")
14
+
15
+ # Download the model file from Hugging Face using the token
16
  model_id = "Arrcttacsrks/netrunner-exe_Insight-Swap-models-onnx"
17
+ model_file = hf_hub_download(repo_id=model_id, filename="simswap_512_unoff.onnx", token=huggingface_token)
18
 
19
  def load_and_preprocess_image(image):
20
  img = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)