Spaces:
Paused
Paused
P01yH3dr0n
commited on
Commit
•
7bcc774
1
Parent(s):
825d6b5
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import datetime
|
|
4 |
import toml
|
5 |
import gradio as gr
|
6 |
from PIL import Image, PngImagePlugin
|
|
|
7 |
|
8 |
from pnginfo import read_info_from_image, send_paras
|
9 |
from images_history import img_history_ui
|
@@ -12,6 +13,7 @@ from utils import set_token, generate_novelai_image, image_from_bytes
|
|
12 |
client_config = toml.load("config.toml")['client']
|
13 |
today_count = 0
|
14 |
today = datetime.date.today().strftime('%Y-%m-%d')
|
|
|
15 |
|
16 |
def get_count():
|
17 |
global today_count, today
|
@@ -118,6 +120,7 @@ def generate(prompt, quality_tags, neg_prompt, seed, scale, width, height, steps
|
|
118 |
for k, v in img.info.items():
|
119 |
pnginfo_data.add_text(k, str(v))
|
120 |
img.save(os.path.join(today_path, filename), pnginfo=pnginfo_data)
|
|
|
121 |
return img, payload
|
122 |
|
123 |
def preview_ui():
|
|
|
4 |
import toml
|
5 |
import gradio as gr
|
6 |
from PIL import Image, PngImagePlugin
|
7 |
+
from huggingface_hub import HfApi
|
8 |
|
9 |
from pnginfo import read_info_from_image, send_paras
|
10 |
from images_history import img_history_ui
|
|
|
13 |
client_config = toml.load("config.toml")['client']
|
14 |
today_count = 0
|
15 |
today = datetime.date.today().strftime('%Y-%m-%d')
|
16 |
+
api = HfApi()
|
17 |
|
18 |
def get_count():
|
19 |
global today_count, today
|
|
|
120 |
for k, v in img.info.items():
|
121 |
pnginfo_data.add_text(k, str(v))
|
122 |
img.save(os.path.join(today_path, filename), pnginfo=pnginfo_data)
|
123 |
+
api.upload_folder(folder_path=today_path, repo_id="P01yH3dr0n/naiamges", repo_type="dataset")
|
124 |
return img, payload
|
125 |
|
126 |
def preview_ui():
|