siriuszeina commited on
Commit
6eb5e1e
1 Parent(s): 63c5c46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import streamlit as st
2
  import shutil
3
  import os
 
 
4
  if os.path.exists("./output/") == False:
5
  os.mkdir("./output/")
6
  project_name = str(st.text_input("Project name")).replace(" ", "-")
@@ -12,10 +14,30 @@ character = st.text_input("character")
12
  anime_from = st.text_input("From")
13
  seed = st.slider('seed', 0, 2147483647)
14
  if st.button("Generate!"):
15
- st.write("hello world")
16
- archived = shutil.make_archive("output", 'zip', "./output/")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  output_num = len(os.listdir("./output/"))
18
  if output_num > 0:
 
19
  st.download_button(label="Download "+str(output_num)+" file", data=archived, file_name='output.zip', mime='application/x-zip')
20
 
21
  print(os.listdir("./"))
 
1
  import streamlit as st
2
  import shutil
3
  import os
4
+ from gradio_client import Client
5
+
6
  if os.path.exists("./output/") == False:
7
  os.mkdir("./output/")
8
  project_name = str(st.text_input("Project name")).replace(" ", "-")
 
14
  anime_from = st.text_input("From")
15
  seed = st.slider('seed', 0, 2147483647)
16
  if st.button("Generate!"):
17
+ client = Client("cagliostrolab/animagine-xl-3.1")
18
+ result = client.predict(
19
+ "1girl, kobo kanaeru, hololive", # str in 'Prompt' Textbox component
20
+ "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
21
+ 0, # float (numeric value between 0 and 2147483647) in 'Seed' Slider component
22
+ 768, # float (numeric value between 512 and 2048) in 'Width' Slider component
23
+ 1344, # float (numeric value between 512 and 2048) in 'Height' Slider component
24
+ 7, # float (numeric value between 1 and 12) in 'Guidance scale' Slider component
25
+ 28, # float (numeric value between 1 and 50) in 'Number of inference steps' Slider component
26
+ "Euler a", # Literal['DPM++ 2M Karras', 'DPM++ SDE Karras', 'DPM++ 2M SDE Karras', 'Euler', 'Euler a', 'DDIM'] in 'Sampler' Dropdown component
27
+ "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
28
+ "(None)", # Literal['(None)', 'Cinematic', 'Photographic', 'Anime', 'Manga', 'Digital Art', 'Pixel art', 'Fantasy art', 'Neonpunk', '3D Model'] in 'Style Preset' Radio component
29
+ "Standard v3.1", # Literal['(None)', 'Standard v3.0', 'Standard v3.1', 'Light v3.1', 'Heavy v3.1'] in 'Quality Tags Presets' Dropdown component
30
+ False, # bool in 'Use Upscaler' Checkbox component
31
+ 0, # float (numeric value between 0 and 1) in 'Strength' Slider component
32
+ 1, # float (numeric value between 1 and 1.5) in 'Upscale by' Slider component
33
+ True, # bool in 'Add Quality Tags' Checkbox component
34
+ api_name="/run"
35
+ )
36
+ st.write(result)
37
+
38
  output_num = len(os.listdir("./output/"))
39
  if output_num > 0:
40
+ archived = shutil.make_archive("output", 'zip', "./output/")
41
  st.download_button(label="Download "+str(output_num)+" file", data=archived, file_name='output.zip', mime='application/x-zip')
42
 
43
  print(os.listdir("./"))