baqu2213 commited on
Commit
ba62c5e
โ€ข
1 Parent(s): 7630596

Upload 2 files

Browse files
Danbooru Prompt Selector/TEST/prompt_selector_auto_1129_TESTv2.exe CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d98d1aef959375ad0f1bf89ef9a58b79e207afd1e47b9e9922cab5a4e2955ab0
3
- size 81747886
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d97e584e1267513494032f9b82dcdd5509fecd4d52b3963a692cdd7244271739
3
+ size 81748020
Danbooru Prompt Selector/TEST/prompt_selector_auto_1129_TESTv2.py CHANGED
@@ -26,6 +26,7 @@ from PIL import Image, ImageOps, ImageFilter,ImageTk
26
  from IPython.display import display
27
  import win32clipboard
28
  from io import BytesIO
 
29
 
30
  BASE_URL="https://api.novelai.net"
31
 
@@ -112,6 +113,17 @@ def generate(width, height, positive, negative, button):
112
  else:
113
  return image
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  global access_token
116
  try:
117
  zipped_bytes = generate_image(access_token, positive, "nai-diffusion-3", "generate", params)
@@ -134,8 +146,12 @@ def generate(width, height, positive, negative, button):
134
  output_file_path = "output_image.jpg"
135
  i.save(output_file_path)
136
  except Exception as e:
137
- text_output.insert(tk.END, f"Error: {e}", fg='red')
138
- button.config(state=tk.NORMAL)
 
 
 
 
139
  time.sleep(random.uniform(2.3, 6.5))
140
  button.config(state=tk.NORMAL)
141
  if mac_var.get():
 
26
  from IPython.display import display
27
  import win32clipboard
28
  from io import BytesIO
29
+ from datetime import datetime
30
 
31
  BASE_URL="https://api.novelai.net"
32
 
 
113
  else:
114
  return image
115
 
116
+ def log_error(e, output_file_path="output_file_path"):
117
+ # ํ˜„์žฌ ์‹œ๊ฐ„์„ ์–ป์Šต๋‹ˆ๋‹ค
118
+ current_time = datetime.now().strftime("%m/%d %H:%M:%S")
119
+
120
+ # ์—๋Ÿฌ ๋กœ๊ทธ ๋ฉ”์‹œ์ง€
121
+ error_message = f"#### Error occured at {current_time} ####\nError: {e}\n############################################\n"
122
+
123
+ # ์ง€์ •๋œ ์ถœ๋ ฅ ํด๋”์˜ error_log.txt ํŒŒ์ผ์— ์“ฐ๊ธฐ
124
+ with open(f"error_log.txt", "a") as file:
125
+ file.write(error_message)
126
+
127
  global access_token
128
  try:
129
  zipped_bytes = generate_image(access_token, positive, "nai-diffusion-3", "generate", params)
 
146
  output_file_path = "output_image.jpg"
147
  i.save(output_file_path)
148
  except Exception as e:
149
+ #text_output.insert(tk.END, f"Error: {e}", fg='red')
150
+ log_error(e, "path_to_output_folder")
151
+ time.sleep(random.uniform(3.0, 9.0))
152
+ button.config(state=tk.DISABLED)
153
+ window.event_generate(GENERATE_EVENT, when="tail")
154
+
155
  time.sleep(random.uniform(2.3, 6.5))
156
  button.config(state=tk.NORMAL)
157
  if mac_var.get():