Spaces:
Sleeping
Sleeping
Commit
•
bcca23e
1
Parent(s):
8adb970
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,14 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from diffusers import StableDiffusion3Pipeline
|
4 |
|
5 |
def image_generation(prompt):
|
6 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
|
|
|
|
|
7 |
pipeline = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers",
|
8 |
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
9 |
text_encoder_3=None,
|
|
|
1 |
+
import os
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from diffusers import StableDiffusion3Pipeline
|
5 |
|
6 |
def image_generation(prompt):
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
+
# Retrieve the token from the environment variable
|
9 |
+
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
10 |
+
print(os.getenv("HUGGINGFACE_TOKEN"))
|
11 |
+
|
12 |
pipeline = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers",
|
13 |
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
14 |
text_encoder_3=None,
|