Spaces:
Sleeping
Sleeping
Ammar Vohra commited on
Commit ·
d03d9a9
1
Parent(s): e5e3abc
changed the model to mem-token
Browse files
app.py
CHANGED
|
@@ -17,11 +17,11 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 17 |
|
| 18 |
vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=dtype).to(device)
|
| 19 |
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=dtype, vae=vae).to(device)
|
| 20 |
-
pipe.load_lora_weights("azad-uddin/
|
| 21 |
torch.cuda.empty_cache()
|
| 22 |
|
| 23 |
MAX_SEED = np.iinfo(np.int32).max
|
| 24 |
-
MAX_IMAGE_SIZE =
|
| 25 |
|
| 26 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
| 27 |
|
|
@@ -33,7 +33,7 @@ def infer(prompt, seed=42, randomize_seed=False, width=512, height=512, guidance
|
|
| 33 |
|
| 34 |
final_img = None
|
| 35 |
for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
|
| 36 |
-
prompt= f"{prompt}
|
| 37 |
guidance_scale=guidance_scale,
|
| 38 |
num_inference_steps=num_inference_steps,
|
| 39 |
width=width,
|
|
@@ -45,8 +45,8 @@ def infer(prompt, seed=42, randomize_seed=False, width=512, height=512, guidance
|
|
| 45 |
final_img = img
|
| 46 |
|
| 47 |
if final_img is not None:
|
| 48 |
-
with tempfile.NamedTemporaryFile(suffix=".
|
| 49 |
-
final_img.save(tmp_file.name, format="
|
| 50 |
image_path = tmp_file.name
|
| 51 |
return image_path
|
| 52 |
return None
|
|
|
|
| 17 |
|
| 18 |
vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=dtype).to(device)
|
| 19 |
pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=dtype, vae=vae).to(device)
|
| 20 |
+
pipe.load_lora_weights("azad-uddin/meme-token", weight_name="meme-token.safetensors")
|
| 21 |
torch.cuda.empty_cache()
|
| 22 |
|
| 23 |
MAX_SEED = np.iinfo(np.int32).max
|
| 24 |
+
MAX_IMAGE_SIZE = 1024
|
| 25 |
|
| 26 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
| 27 |
|
|
|
|
| 33 |
|
| 34 |
final_img = None
|
| 35 |
for img in pipe.flux_pipe_call_that_returns_an_iterable_of_images(
|
| 36 |
+
prompt= f"memestylx, {prompt}, all within a circular emblem",
|
| 37 |
guidance_scale=guidance_scale,
|
| 38 |
num_inference_steps=num_inference_steps,
|
| 39 |
width=width,
|
|
|
|
| 45 |
final_img = img
|
| 46 |
|
| 47 |
if final_img is not None:
|
| 48 |
+
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as tmp_file:
|
| 49 |
+
final_img.save(tmp_file.name, format="PNG")
|
| 50 |
image_path = tmp_file.name
|
| 51 |
return image_path
|
| 52 |
return None
|