Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import pyperclip
|
2 |
import os
|
|
|
3 |
from PIL import Image
|
4 |
from sd_parsers import ParserManager
|
5 |
import gradio as gr
|
@@ -198,13 +199,14 @@ def save_metadata_to_file(image_input, prompt, neg_prompt, model, loras, seed, s
|
|
198 |
f"Other Metadata:\n{metadata}\n"
|
199 |
)
|
200 |
|
201 |
-
#
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
205 |
|
206 |
-
# Trả về đường dẫn tệp tin để tự động tải xuống
|
207 |
-
return txt_filename, gr.Info(f"Đang tải file {txt_filename}...", duration=2)
|
208 |
|
209 |
def check_image_size(image_input):
|
210 |
try:
|
|
|
1 |
import pyperclip
|
2 |
import os
|
3 |
+
import io
|
4 |
from PIL import Image
|
5 |
from sd_parsers import ParserManager
|
6 |
import gradio as gr
|
|
|
199 |
f"Other Metadata:\n{metadata}\n"
|
200 |
)
|
201 |
|
202 |
+
# Sử dụng io.BytesIO để tạo file tạm thời trong bộ nhớ
|
203 |
+
txt_file = io.BytesIO()
|
204 |
+
txt_file.write(file_content.encode('utf-8'))
|
205 |
+
txt_file.seek(0)
|
206 |
+
|
207 |
+
# Trả về file để tải xuống
|
208 |
+
return txt_file, gr.Info(f"Đang tải file metadata.txt...", duration=2)
|
209 |
|
|
|
|
|
210 |
|
211 |
def check_image_size(image_input):
|
212 |
try:
|