naonauno commited on
Commit
ceba152
·
verified ·
1 Parent(s): d4a560e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,20 +1,26 @@
1
  import gradio as gr
2
  import torch
3
  from diffusers import StableDiffusionPipeline
4
- from huggingface_hub import hf_hub_download
 
 
 
 
5
 
6
  # Initialize the pipeline with CPU
7
  model_id = "runwayml/stable-diffusion-v1-5"
8
  pipe = StableDiffusionPipeline.from_pretrained(
9
  model_id,
10
  torch_dtype=torch.float32,
 
11
  )
12
 
13
  # Load your LoRA weights
14
  lora_path = "naonauno/40k-half-sd15"
15
  pipe.load_lora_weights(
16
  lora_path,
17
- weight_name="40kHalf.safetensors"
 
18
  )
19
 
20
  # Set the cross attention processor scale
 
1
  import gradio as gr
2
  import torch
3
  from diffusers import StableDiffusionPipeline
4
+ import os
5
+ from huggingface_hub import login
6
+
7
+ # Login using the token
8
+ login(token=os.environ.get("HF_TOKEN"))
9
 
10
  # Initialize the pipeline with CPU
11
  model_id = "runwayml/stable-diffusion-v1-5"
12
  pipe = StableDiffusionPipeline.from_pretrained(
13
  model_id,
14
  torch_dtype=torch.float32,
15
+ use_auth_token=os.environ.get("HF_TOKEN")
16
  )
17
 
18
  # Load your LoRA weights
19
  lora_path = "naonauno/40k-half-sd15"
20
  pipe.load_lora_weights(
21
  lora_path,
22
+ weight_name="40kHalf.safetensors",
23
+ use_auth_token=os.environ.get("HF_TOKEN")
24
  )
25
 
26
  # Set the cross attention processor scale