LeonJHKIM commited on
Commit
91fefb1
·
1 Parent(s): dc83899

update consistency value

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -24,8 +24,6 @@ TOKEN = os.environ.get("TOKEN")
24
 
25
 
26
 
27
-
28
-
29
  server_address = remote_url
30
  client_id = str(uuid.uuid4())
31
 
@@ -52,10 +50,10 @@ def get_queue_status(server_address):
52
  print(f"Error retrieving queue info: {e}")
53
  return {'queue_running': 0, 'queue_pending': 0} # Return 0s if there is an error or connection issue
54
 
55
- def queue_prompt(workflow, bg_color, pos_prompt, password, images_base64, id_strength, consistency_magic_input):
56
  p = {"prompt": {"dummy":"dummy"}, "client_id": client_id, "api":"silosnap_portrait", "workflow":workflow,
57
  "bg_color":bg_color, "pos_prompt":pos_prompt, "pass":password, "upimages":images_base64,
58
- "id_strength":id_strength, "consistency_magic_input":consistency_magic_input}
59
  data = json.dumps(p).encode('utf-8')
60
  req = urllib.request.Request("http://{}/prompt?token={}".format(server_address, TOKEN), data=data)
61
  # req = urllib.request.Request("http://{}/prompt".format(server_address), data=data, headers={'Content-Type': 'application/json'})
@@ -73,8 +71,8 @@ def get_history(prompt_id):
73
  with urllib.request.urlopen("http://{}/history/{}?token={}".format(server_address, prompt_id, TOKEN)) as response:
74
  return json.loads(response.read())
75
 
76
- def get_images(ws, workflow, bg_color, pos_prompt, password, images_base64, id_strength, consistency_magic_input):
77
- prompt_id = queue_prompt(workflow, bg_color, pos_prompt, password, images_base64, id_strength, consistency_magic_input)['prompt_id']
78
  output_images = {}
79
  while True:
80
  out = ws.recv()
@@ -105,7 +103,7 @@ def get_images(ws, workflow, bg_color, pos_prompt, password, images_base64, id_s
105
  #------------------------------------------------------------
106
 
107
  def main():
108
- st.title("SILO.AI - AMDsnap ver.1.1.leon ")
109
 
110
  workflow = 'amdsnap_style'
111
  bg_color = "white"
@@ -152,8 +150,8 @@ def main():
152
 
153
 
154
  # Number input for consistency magic value
155
- consistency_magic_input = st.number_input(
156
- "🦄 Consistency Magic Value (1 ~ 4,294,967,294):",
157
  min_value=1,
158
  max_value=4294967294,
159
  value=None,
@@ -200,7 +198,7 @@ def main():
200
  st.error(f"Please check your server address: {server_address}")
201
  return
202
 
203
- images = get_images(ws, workflow, bg_color, text_prompt, password, images_base64, id_strength, consistency_magic_input)
204
  ws.close()
205
  gif_runner.empty() # Remove the GIF after processing is done
206
 
@@ -221,5 +219,5 @@ def main():
221
  st.write("No images returned.")
222
 
223
  if __name__ == "__main__":
224
- # main()
225
- st.title("Updating.. wiat a 10~20 min, sorry! ")
 
24
 
25
 
26
 
 
 
27
  server_address = remote_url
28
  client_id = str(uuid.uuid4())
29
 
 
50
  print(f"Error retrieving queue info: {e}")
51
  return {'queue_running': 0, 'queue_pending': 0} # Return 0s if there is an error or connection issue
52
 
53
+ def queue_prompt(workflow, bg_color, pos_prompt, password, images_base64, id_strength, consistency_magic):
54
  p = {"prompt": {"dummy":"dummy"}, "client_id": client_id, "api":"silosnap_portrait", "workflow":workflow,
55
  "bg_color":bg_color, "pos_prompt":pos_prompt, "pass":password, "upimages":images_base64,
56
+ "id_strength":id_strength, "consistency_magic":consistency_magic}
57
  data = json.dumps(p).encode('utf-8')
58
  req = urllib.request.Request("http://{}/prompt?token={}".format(server_address, TOKEN), data=data)
59
  # req = urllib.request.Request("http://{}/prompt".format(server_address), data=data, headers={'Content-Type': 'application/json'})
 
71
  with urllib.request.urlopen("http://{}/history/{}?token={}".format(server_address, prompt_id, TOKEN)) as response:
72
  return json.loads(response.read())
73
 
74
+ def get_images(ws, workflow, bg_color, pos_prompt, password, images_base64, id_strength, consistency_magic):
75
+ prompt_id = queue_prompt(workflow, bg_color, pos_prompt, password, images_base64, id_strength, consistency_magic)['prompt_id']
76
  output_images = {}
77
  while True:
78
  out = ws.recv()
 
103
  #------------------------------------------------------------
104
 
105
  def main():
106
+ st.title("SILO.AI - AMDsnap ver.1.2.leon ")
107
 
108
  workflow = 'amdsnap_style'
109
  bg_color = "white"
 
150
 
151
 
152
  # Number input for consistency magic value
153
+ consistency_magic = st.number_input(
154
+ "🦄 Style Consistency Magic Value (1 ~ 4,294,967,294):",
155
  min_value=1,
156
  max_value=4294967294,
157
  value=None,
 
198
  st.error(f"Please check your server address: {server_address}")
199
  return
200
 
201
+ images = get_images(ws, workflow, bg_color, text_prompt, password, images_base64, id_strength, consistency_magic)
202
  ws.close()
203
  gif_runner.empty() # Remove the GIF after processing is done
204
 
 
219
  st.write("No images returned.")
220
 
221
  if __name__ == "__main__":
222
+ main()
223
+ # st.title("Updating.. wiat a 10~20 min, sorry! ")