kadirnar commited on
Commit
2b75ed8
·
verified ·
1 Parent(s): fb5f878

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -12,10 +12,7 @@ from huggingface_hub import snapshot_download
12
 
13
  # Çevre değişkeninden token'ı al
14
  huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
15
-
16
- if huggingface_token is None:
17
- raise ValueError("HUGGINGFACE_TOKEN environment variable is not set.")
18
-
19
  # Model ve VAE dosyalarını indir
20
  model_path = snapshot_download(
21
  repo_id="stabilityai/stable-diffusion-3-medium",
@@ -26,11 +23,7 @@ model_path = snapshot_download(
26
  )
27
  print(model_path)
28
 
29
- vae_path = snapshot_download(
30
- repo_id="madebyollin/sdxl-vae-fp16-fix",
31
- token=huggingface_token
32
- )
33
-
34
  DESCRIPTION = """# Stable Diffusion 3"""
35
  if not torch.cuda.is_available():
36
  DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
@@ -46,8 +39,11 @@ device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
46
  # VAE modelini yükle
47
  vae = AutoencoderKL.from_pretrained(vae_path, torch_dtype=torch.float16)
48
 
49
- # Stable Diffusion pipeline'ı yükle
50
- pipe = StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16)
 
 
 
51
  pipe.to(device)
52
 
53
  def save_image(img):
 
12
 
13
  # Çevre değişkeninden token'ı al
14
  huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
15
+ """
 
 
 
16
  # Model ve VAE dosyalarını indir
17
  model_path = snapshot_download(
18
  repo_id="stabilityai/stable-diffusion-3-medium",
 
23
  )
24
  print(model_path)
25
 
26
+ """
 
 
 
 
27
  DESCRIPTION = """# Stable Diffusion 3"""
28
  if not torch.cuda.is_available():
29
  DESCRIPTION += "\n<p>Running on CPU 🥶 This demo may not work on CPU.</p>"
 
39
  # VAE modelini yükle
40
  vae = AutoencoderKL.from_pretrained(vae_path, torch_dtype=torch.float16)
41
 
42
+ pipe = StableDiffusionPipeline.from_single_file(
43
+ "https://huggingface.co/stabilityai/stable-diffusion-3-medium/blob/main/tachyon.safetensors",
44
+ torch_dtype=torch.float16,
45
+ use_auth_token=huggingface_token
46
+ )
47
  pipe.to(device)
48
 
49
  def save_image(img):