aimersion commited on
Commit
9583fce
·
verified ·
1 Parent(s): 2cb4198

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -10
app.py CHANGED
@@ -6,7 +6,6 @@ import torch
6
  import os
7
  import time
8
  from diffusers import DiffusionPipeline
9
- from huggingface_hub import login
10
 
11
  # Ensure sentencepiece is installed in your environment
12
  try:
@@ -14,19 +13,11 @@ try:
14
  except ImportError:
15
  raise ImportError("The 'sentencepiece' library is required but not installed. Please add it to your environment.")
16
 
17
- # Access the API token securely from Hugging Face Secrets
18
- hf_api_token = os.getenv("HF_API_TOKEN")
19
-
20
- if hf_api_token:
21
- login(token=hf_api_token)
22
- else:
23
- raise ValueError("Hugging Face API token not found in secrets.")
24
-
25
  # Set the device and dtype
26
  dtype = torch.bfloat16
27
  device = "cuda" if torch.cuda.is_available() else "cpu"
28
 
29
- # Load the diffusion pipeline from the gated repository
30
  pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell")
31
 
32
  MAX_SEED = np.iinfo(np.int32).max
 
6
  import os
7
  import time
8
  from diffusers import DiffusionPipeline
 
9
 
10
  # Ensure sentencepiece is installed in your environment
11
  try:
 
13
  except ImportError:
14
  raise ImportError("The 'sentencepiece' library is required but not installed. Please add it to your environment.")
15
 
 
 
 
 
 
 
 
 
16
  # Set the device and dtype
17
  dtype = torch.bfloat16
18
  device = "cuda" if torch.cuda.is_available() else "cpu"
19
 
20
+ # Load the diffusion pipeline without requiring an API token
21
  pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell")
22
 
23
  MAX_SEED = np.iinfo(np.int32).max