Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,6 @@ translator = Translator()
|
|
| 13 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 14 |
# Constants
|
| 15 |
model = "stabilityai/stable-diffusion-3-medium"
|
| 16 |
-
vae_model = "madebyollin/sdxl-vae-fp16-fix"
|
| 17 |
|
| 18 |
|
| 19 |
model_path = snapshot_download(
|
|
@@ -44,15 +43,11 @@ JS = """function () {
|
|
| 44 |
}"""
|
| 45 |
|
| 46 |
|
| 47 |
-
|
| 48 |
-
vae = AutoencoderKL.from_pretrained(
|
| 49 |
-
vae_model,
|
| 50 |
-
torch_dtype=torch.float16
|
| 51 |
-
)
|
| 52 |
|
| 53 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
| 54 |
if torch.cuda.is_available():
|
| 55 |
-
pipe = StableDiffusion3Pipeline.from_pretrained(model_path,
|
| 56 |
|
| 57 |
|
| 58 |
# Function
|
|
@@ -97,7 +92,7 @@ examples = [
|
|
| 97 |
|
| 98 |
with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
| 99 |
gr.HTML("<h1><center>SD3M🦄</center></h1>")
|
| 100 |
-
gr.HTML("<p><center><a href='https://huggingface.co/
|
| 101 |
with gr.Group():
|
| 102 |
with gr.Row():
|
| 103 |
prompt = gr.Textbox(label='Enter Your Prompt', value="best quality, HD, aesthetic", scale=6)
|
|
|
|
| 13 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 14 |
# Constants
|
| 15 |
model = "stabilityai/stable-diffusion-3-medium"
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
model_path = snapshot_download(
|
|
|
|
| 43 |
}"""
|
| 44 |
|
| 45 |
|
| 46 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
| 49 |
if torch.cuda.is_available():
|
| 50 |
+
pipe = StableDiffusion3Pipeline.from_pretrained(model_path, torch_dtype=torch.float16).to("cuda")
|
| 51 |
|
| 52 |
|
| 53 |
# Function
|
|
|
|
| 92 |
|
| 93 |
with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
| 94 |
gr.HTML("<h1><center>SD3M🦄</center></h1>")
|
| 95 |
+
gr.HTML("<p><center><a href='https://huggingface.co/stabilityai/stable-diffusion-3-medium'>sd3m</a> text-to-image generation</center><br><center>Multi-Languages. Adding default prompts to enhance.</center></p>")
|
| 96 |
with gr.Group():
|
| 97 |
with gr.Row():
|
| 98 |
prompt = gr.Textbox(label='Enter Your Prompt', value="best quality, HD, aesthetic", scale=6)
|