Spaces:
Runtime error
Runtime error
pass token to model directly
Browse files
app.py
CHANGED
|
@@ -3,13 +3,10 @@ import gradio as gr
|
|
| 3 |
import numpy as np
|
| 4 |
import random
|
| 5 |
import os
|
| 6 |
-
from huggingface_hub import login
|
| 7 |
|
| 8 |
# import spaces #[uncomment to use ZeroGPU]
|
| 9 |
from diffusers import DiffusionPipeline
|
| 10 |
import torch
|
| 11 |
-
import transformers
|
| 12 |
-
transformers.utils.move_cache()
|
| 13 |
|
| 14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 15 |
model_repo_id = "stabilityai/stable-diffusion-3.5-large" # Replace to the model you would like to use
|
|
@@ -24,9 +21,7 @@ huggingface_token = os.getenv('HUGGING_FACE_TOKEN')
|
|
| 24 |
if huggingface_token is None:
|
| 25 |
raise ValueError("HUGGING_FACE_TOKEN environment variable not set.")
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
| 30 |
pipe = pipe.to(device)
|
| 31 |
|
| 32 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
import random
|
| 5 |
import os
|
|
|
|
| 6 |
|
| 7 |
# import spaces #[uncomment to use ZeroGPU]
|
| 8 |
from diffusers import DiffusionPipeline
|
| 9 |
import torch
|
|
|
|
|
|
|
| 10 |
|
| 11 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 12 |
model_repo_id = "stabilityai/stable-diffusion-3.5-large" # Replace to the model you would like to use
|
|
|
|
| 21 |
if huggingface_token is None:
|
| 22 |
raise ValueError("HUGGING_FACE_TOKEN environment variable not set.")
|
| 23 |
|
| 24 |
+
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype, token=huggingface_token)
|
|
|
|
|
|
|
| 25 |
pipe = pipe.to(device)
|
| 26 |
|
| 27 |
MAX_SEED = np.iinfo(np.int32).max
|