Spaces:
Running
Running
salomonsky
commited on
Commit
•
8fe1e3d
1
Parent(s):
f02cbc6
Update app.py
Browse files
app.py
CHANGED
@@ -64,6 +64,12 @@ def swap_faces(source_image, source_face_index, destination_image, destination_f
|
|
64 |
result = swapper.get(destination_image, res_face, source_face, paste_back=True)
|
65 |
return result
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
async def gen(prompt, width, height, model_name):
|
68 |
seed = PREDEFINED_SEED
|
69 |
image, seed = await generate_image(prompt, width, height, seed, model_name)
|
|
|
64 |
result = swapper.get(destination_image, res_face, source_face, paste_back=True)
|
65 |
return result
|
66 |
|
67 |
+
async def generate_image(prompt, width, height, seed, model_name):
|
68 |
+
if seed == -1:
|
69 |
+
seed = random.randint(0, MAX_SEED)
|
70 |
+
image = await client.text_to_image(prompt=prompt, height=height, width=width, model=model_name)
|
71 |
+
return image, seed
|
72 |
+
|
73 |
async def gen(prompt, width, height, model_name):
|
74 |
seed = PREDEFINED_SEED
|
75 |
image, seed = await generate_image(prompt, width, height, seed, model_name)
|