Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,7 @@ try:
|
|
| 17 |
"meta-llama/Meta-Llama-3.1-8B-Instruct",
|
| 18 |
output_hidden_states=True,
|
| 19 |
output_attentions=True,
|
|
|
|
| 20 |
torch_dtype=dtype,
|
| 21 |
).to(device)
|
| 22 |
except Exception as e:
|
|
@@ -25,7 +26,7 @@ except Exception as e:
|
|
| 25 |
# Load the HiDreamImagePipeline
|
| 26 |
try:
|
| 27 |
pipe = HiDreamImagePipeline.from_pretrained(
|
| 28 |
-
"HiDream-ai/HiDream-I1-
|
| 29 |
tokenizer_4=tokenizer_4,
|
| 30 |
text_encoder_4=text_encoder_4,
|
| 31 |
torch_dtype=dtype,
|
|
@@ -40,7 +41,7 @@ MAX_IMAGE_SIZE = 2048
|
|
| 40 |
|
| 41 |
# Inference function with GPU access
|
| 42 |
@spaces.GPU()
|
| 43 |
-
def infer(prompt, negative_prompt="", seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=
|
| 44 |
try:
|
| 45 |
if randomize_seed:
|
| 46 |
seed = random.randint(0, MAX_SEED)
|
|
@@ -126,7 +127,7 @@ with gr.Blocks(css=css) as app:
|
|
| 126 |
with gr.Row():
|
| 127 |
steps = gr.Slider(
|
| 128 |
label="Inference Steps",
|
| 129 |
-
value=
|
| 130 |
minimum=1,
|
| 131 |
maximum=100,
|
| 132 |
step=1
|
|
|
|
| 17 |
"meta-llama/Meta-Llama-3.1-8B-Instruct",
|
| 18 |
output_hidden_states=True,
|
| 19 |
output_attentions=True,
|
| 20 |
+
attn_implementation="eager",
|
| 21 |
torch_dtype=dtype,
|
| 22 |
).to(device)
|
| 23 |
except Exception as e:
|
|
|
|
| 26 |
# Load the HiDreamImagePipeline
|
| 27 |
try:
|
| 28 |
pipe = HiDreamImagePipeline.from_pretrained(
|
| 29 |
+
"HiDream-ai/HiDream-I1-Fast",
|
| 30 |
tokenizer_4=tokenizer_4,
|
| 31 |
text_encoder_4=text_encoder_4,
|
| 32 |
torch_dtype=dtype,
|
|
|
|
| 41 |
|
| 42 |
# Inference function with GPU access
|
| 43 |
@spaces.GPU()
|
| 44 |
+
def infer(prompt, negative_prompt="", seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=16, guidance_scale=3.5, progress=gr.Progress(track_tqdm=True)):
|
| 45 |
try:
|
| 46 |
if randomize_seed:
|
| 47 |
seed = random.randint(0, MAX_SEED)
|
|
|
|
| 127 |
with gr.Row():
|
| 128 |
steps = gr.Slider(
|
| 129 |
label="Inference Steps",
|
| 130 |
+
value=16,
|
| 131 |
minimum=1,
|
| 132 |
maximum=100,
|
| 133 |
step=1
|