Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -23,13 +23,12 @@ import jax
|
|
23 |
import jax.numpy as jnp
|
24 |
|
25 |
last_motion=None
|
26 |
-
fps=
|
27 |
-
time=
|
28 |
device = "cuda"
|
29 |
dtype = torch.float16
|
30 |
result=[]
|
31 |
step = 2
|
32 |
-
progress=gr.Progress()
|
33 |
|
34 |
css="""
|
35 |
input, input::placeholder {
|
@@ -72,9 +71,9 @@ function custom(){
|
|
72 |
}
|
73 |
"""
|
74 |
|
75 |
-
def forest_schnell():
|
76 |
-
PIPE = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token")).to("cuda")
|
77 |
-
return PIPE
|
78 |
|
79 |
def translate(text,lang):
|
80 |
if text == None or lang == None:
|
@@ -117,10 +116,6 @@ def translate(text,lang):
|
|
117 |
print(ret)
|
118 |
return ret
|
119 |
|
120 |
-
def progress_callback(i, t, z):
|
121 |
-
global progress
|
122 |
-
progress((i+1, step))
|
123 |
-
|
124 |
def generate_random_string(length):
|
125 |
characters = string.ascii_letters + string.digits
|
126 |
return ''.join(random.choice(characters) for _ in range(length))
|
@@ -131,7 +126,6 @@ def Piper(name,positive_prompt,negative,motion):
|
|
131 |
global fps
|
132 |
global time
|
133 |
global last_motion
|
134 |
-
global progress
|
135 |
global base
|
136 |
global device
|
137 |
|
@@ -142,7 +136,7 @@ def Piper(name,positive_prompt,negative,motion):
|
|
142 |
pipe.set_adapters(["motion"], [0.7])
|
143 |
last_motion = motion
|
144 |
|
145 |
-
|
146 |
positive_prompt,
|
147 |
negative_prompt=negative,
|
148 |
height=1024,
|
@@ -152,9 +146,6 @@ def Piper(name,positive_prompt,negative,motion):
|
|
152 |
num_frames=(fps*time)
|
153 |
)
|
154 |
|
155 |
-
export_to_gif(out.frames[0],name,fps=fps)
|
156 |
-
return name
|
157 |
-
|
158 |
def infer(pm):
|
159 |
print("infer: started")
|
160 |
|
@@ -167,7 +158,9 @@ def infer(pm):
|
|
167 |
_do.append(f'{p1}')
|
168 |
posi = " ".join(_do)+neg
|
169 |
|
170 |
-
|
|
|
|
|
171 |
|
172 |
def run(m,p1,p2,*result):
|
173 |
|
|
|
23 |
import jax.numpy as jnp
|
24 |
|
25 |
last_motion=None
|
26 |
+
fps=10
|
27 |
+
time=2
|
28 |
device = "cuda"
|
29 |
dtype = torch.float16
|
30 |
result=[]
|
31 |
step = 2
|
|
|
32 |
|
33 |
css="""
|
34 |
input, input::placeholder {
|
|
|
71 |
}
|
72 |
"""
|
73 |
|
74 |
+
#def forest_schnell():
|
75 |
+
# PIPE = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token")).to("cuda")
|
76 |
+
# return PIPE
|
77 |
|
78 |
def translate(text,lang):
|
79 |
if text == None or lang == None:
|
|
|
116 |
print(ret)
|
117 |
return ret
|
118 |
|
|
|
|
|
|
|
|
|
119 |
def generate_random_string(length):
|
120 |
characters = string.ascii_letters + string.digits
|
121 |
return ''.join(random.choice(characters) for _ in range(length))
|
|
|
126 |
global fps
|
127 |
global time
|
128 |
global last_motion
|
|
|
129 |
global base
|
130 |
global device
|
131 |
|
|
|
136 |
pipe.set_adapters(["motion"], [0.7])
|
137 |
last_motion = motion
|
138 |
|
139 |
+
return pipe(
|
140 |
positive_prompt,
|
141 |
negative_prompt=negative,
|
142 |
height=1024,
|
|
|
146 |
num_frames=(fps*time)
|
147 |
)
|
148 |
|
|
|
|
|
|
|
149 |
def infer(pm):
|
150 |
print("infer: started")
|
151 |
|
|
|
158 |
_do.append(f'{p1}')
|
159 |
posi = " ".join(_do)+neg
|
160 |
|
161 |
+
out = Piper(name,posi,neg,pm["m"])
|
162 |
+
export_to_gif(out.frames[0],name,fps=fps)
|
163 |
+
return name
|
164 |
|
165 |
def run(m,p1,p2,*result):
|
166 |
|