Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ from diffusers.pipelines.flux import FluxPipeline
|
|
17 |
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
dtype = torch.bfloat16
|
20 |
-
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-
|
21 |
|
22 |
def translate(text,lang):
|
23 |
|
@@ -77,16 +77,16 @@ def generate_random_string(length):
|
|
77 |
characters = string.ascii_letters + string.digits
|
78 |
return ''.join(random.choice(characters) for _ in range(length))
|
79 |
|
80 |
-
@spaces.GPU(duration=
|
81 |
def Piper(_do):
|
82 |
try:
|
83 |
retu = pipe(
|
84 |
_do,
|
85 |
-
height=
|
86 |
-
width=
|
87 |
-
num_inference_steps=
|
88 |
-
max_sequence_length=
|
89 |
-
guidance_scale=
|
90 |
)
|
91 |
return retu
|
92 |
except:
|
|
|
17 |
|
18 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
19 |
dtype = torch.bfloat16
|
20 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=dtype, token=os.getenv("hf_token")).to(device)
|
21 |
|
22 |
def translate(text,lang):
|
23 |
|
|
|
77 |
characters = string.ascii_letters + string.digits
|
78 |
return ''.join(random.choice(characters) for _ in range(length))
|
79 |
|
80 |
+
@spaces.GPU(duration=50)
|
81 |
def Piper(_do):
|
82 |
try:
|
83 |
retu = pipe(
|
84 |
_do,
|
85 |
+
height=4096,
|
86 |
+
width=4096,
|
87 |
+
num_inference_steps=4,
|
88 |
+
max_sequence_length=256,
|
89 |
+
guidance_scale=2
|
90 |
)
|
91 |
return retu
|
92 |
except:
|