Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,7 @@ from diffusers.utils import load_image
|
|
| 22 |
#import jax.numpy as jnp
|
| 23 |
import torch._dynamo
|
| 24 |
|
| 25 |
-
|
| 26 |
torch._dynamo.config.suppress_errors = True
|
| 27 |
|
| 28 |
#pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, revision="refs/pr/1", token=os.getenv("hf_token")).to(device)
|
|
@@ -89,7 +89,6 @@ def generate_random_string(length):
|
|
| 89 |
characters = string.ascii_letters + string.digits
|
| 90 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 91 |
|
| 92 |
-
@spaces.GPU(duration=35)
|
| 93 |
def Piper(_do):
|
| 94 |
pipe = pipe_t2i()
|
| 95 |
try:
|
|
@@ -106,7 +105,6 @@ def Piper(_do):
|
|
| 106 |
print(e)
|
| 107 |
return None
|
| 108 |
|
| 109 |
-
@spaces.GPU(duration=35)
|
| 110 |
def Piper2(img,posi,neg):
|
| 111 |
pipe = pipe_i2i()
|
| 112 |
try:
|
|
@@ -120,12 +118,12 @@ def Piper2(img,posi,neg):
|
|
| 120 |
print(e)
|
| 121 |
return None
|
| 122 |
|
| 123 |
-
@spaces.GPU(duration=35)
|
| 124 |
def tok(txt):
|
| 125 |
toks = pipe.tokenizer(txt)['input_ids']
|
| 126 |
print(toks)
|
| 127 |
return toks
|
| 128 |
-
|
|
|
|
| 129 |
def infer(p1,p2):
|
| 130 |
name = generate_random_string(12)+".png"
|
| 131 |
_do = ['beautiful', 'playful', 'photographed', 'realistic', 'dynamic poze', 'deep field', 'reasonable coloring', 'rough texture', 'best quality', 'focused']
|
|
|
|
| 22 |
#import jax.numpy as jnp
|
| 23 |
import torch._dynamo
|
| 24 |
|
| 25 |
+
set_start_method("spawn", force=True)
|
| 26 |
torch._dynamo.config.suppress_errors = True
|
| 27 |
|
| 28 |
#pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, revision="refs/pr/1", token=os.getenv("hf_token")).to(device)
|
|
|
|
| 89 |
characters = string.ascii_letters + string.digits
|
| 90 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 91 |
|
|
|
|
| 92 |
def Piper(_do):
|
| 93 |
pipe = pipe_t2i()
|
| 94 |
try:
|
|
|
|
| 105 |
print(e)
|
| 106 |
return None
|
| 107 |
|
|
|
|
| 108 |
def Piper2(img,posi,neg):
|
| 109 |
pipe = pipe_i2i()
|
| 110 |
try:
|
|
|
|
| 118 |
print(e)
|
| 119 |
return None
|
| 120 |
|
|
|
|
| 121 |
def tok(txt):
|
| 122 |
toks = pipe.tokenizer(txt)['input_ids']
|
| 123 |
print(toks)
|
| 124 |
return toks
|
| 125 |
+
|
| 126 |
+
@spaces.GPU(duration=75)
|
| 127 |
def infer(p1,p2):
|
| 128 |
name = generate_random_string(12)+".png"
|
| 129 |
_do = ['beautiful', 'playful', 'photographed', 'realistic', 'dynamic poze', 'deep field', 'reasonable coloring', 'rough texture', 'best quality', 'focused']
|