Spaces:
Runtime error
Runtime error
siriuszeina
commited on
Commit
•
f1470af
1
Parent(s):
ba9035e
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
import streamlit as st
|
2 |
import shutil
|
3 |
import os
|
|
|
|
|
|
|
4 |
from gradio_client import Client
|
5 |
prompt_prefix = "night, full body, closed mouth, happy face, walking front, "
|
6 |
prompt_list = [
|
@@ -33,13 +36,41 @@ prompt_list = [
|
|
33 |
prompt_suffix = ", masterpiece, best quality, very aesthetic, absurdres"
|
34 |
if os.path.exists("./output/") == False:
|
35 |
os.mkdir("./output/")
|
|
|
|
|
|
|
|
|
36 |
project_name = str(st.text_input("Project name")).replace(" ", "-")
|
37 |
character = st.text_input("character")
|
38 |
anime_from = st.text_input("From")
|
39 |
-
seed = st.
|
40 |
if st.button("Generate!"):
|
|
|
41 |
for p in prompt_list:
|
42 |
prompt_new = "1girl, "+character+", "+anime_from+", "+prompt_prefix+p+prompt_suffix
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
print(prompt_new)
|
44 |
|
45 |
output_num = len(os.listdir("./output/"))
|
|
|
1 |
import streamlit as st
|
2 |
import shutil
|
3 |
import os
|
4 |
+
from PIL import Image
|
5 |
+
import requests
|
6 |
+
|
7 |
from gradio_client import Client
|
8 |
prompt_prefix = "night, full body, closed mouth, happy face, walking front, "
|
9 |
prompt_list = [
|
|
|
36 |
prompt_suffix = ", masterpiece, best quality, very aesthetic, absurdres"
|
37 |
if os.path.exists("./output/") == False:
|
38 |
os.mkdir("./output/")
|
39 |
+
if os.path.exists("./frames/") == False:
|
40 |
+
os.mkdir("./frames/")
|
41 |
+
if os.path.exists("./interpolations/") == False:
|
42 |
+
os.mkdir("./interpolations/")
|
43 |
project_name = str(st.text_input("Project name")).replace(" ", "-")
|
44 |
character = st.text_input("character")
|
45 |
anime_from = st.text_input("From")
|
46 |
+
seed = st.number_input('seed')
|
47 |
if st.button("Generate!"):
|
48 |
+
n = 0
|
49 |
for p in prompt_list:
|
50 |
prompt_new = "1girl, "+character+", "+anime_from+", "+prompt_prefix+p+prompt_suffix
|
51 |
+
client = Client("cagliostrolab/animagine-xl-3.1")
|
52 |
+
result = client.predict(
|
53 |
+
prompt_new, # str in 'Prompt' Textbox component
|
54 |
+
"nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]", # str in 'Negative Prompt' Textbox component
|
55 |
+
seed, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component
|
56 |
+
768, # float (numeric value between 512 and 2048) in 'Width' Slider component
|
57 |
+
1344, # float (numeric value between 512 and 2048) in 'Height' Slider component
|
58 |
+
7, # float (numeric value between 1 and 12) in 'Guidance scale' Slider component
|
59 |
+
28, # float (numeric value between 1 and 50) in 'Number of inference steps' Slider component
|
60 |
+
"Euler a", # Literal['DPM++ 2M Karras', 'DPM++ SDE Karras', 'DPM++ 2M SDE Karras', 'Euler', 'Euler a', 'DDIM'] in 'Sampler' Dropdown component
|
61 |
+
"768 x 1344", # Literal['1024 x 1024', '1152 x 896', '896 x 1152', '1216 x 832', '832 x 1216', '1344 x 768', '768 x 1344', '1536 x 640', '640 x 1536', 'Custom'] in 'Aspect Ratio' Radio component
|
62 |
+
"(None)", # Literal['(None)', 'Cinematic', 'Photographic', 'Anime', 'Manga', 'Digital Art', 'Pixel art', 'Fantasy art', 'Neonpunk', '3D Model'] in 'Style Preset' Radio component
|
63 |
+
"Standard v3.1", # Literal['(None)', 'Standard v3.0', 'Standard v3.1', 'Light v3.1', 'Heavy v3.1'] in 'Quality Tags Presets' Dropdown component
|
64 |
+
False, # bool in 'Use Upscaler' Checkbox component
|
65 |
+
0, # float (numeric value between 0 and 1) in 'Strength' Slider component
|
66 |
+
1, # float (numeric value between 1 and 1.5) in 'Upscale by' Slider component
|
67 |
+
True, # bool in 'Add Quality Tags' Checkbox component
|
68 |
+
api_name="/run"
|
69 |
+
)
|
70 |
+
source = 'https://cagliostrolab-animagine-xl-3-1.hf.space/file='+result[0][0]["image"]
|
71 |
+
frame = Image.open(requests.get(source, stream=True).raw)
|
72 |
+
frame.save("./output/"+str(n)+".png")
|
73 |
+
n += 1
|
74 |
print(prompt_new)
|
75 |
|
76 |
output_num = len(os.listdir("./output/"))
|