P01yH3dr0n commited on
Commit
e56790d
1 Parent(s): 1e9ddc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -15
app.py CHANGED
@@ -3,10 +3,8 @@ import datetime
3
 
4
  import gradio as gr
5
  from pnginfo import read_info_from_image, send_paras
6
- from images_history import img_history_ui
7
 
8
  from utils import set_token, generate_novelai_image, image_from_bytes
9
- from PIL import PngImagePlugin
10
 
11
  today_count = 0
12
  today = datetime.date.today().strftime('%Y-%m-%d')
@@ -23,11 +21,11 @@ def control_ui():
23
  prompt = gr.TextArea(label="Prompt", lines=3)
24
  quality_tags = gr.TextArea(
25
  label="Quality Tags", lines=1,
26
- value=client_config['default_quality'],
27
  )
28
  neg_prompt = gr.TextArea(
29
  label="Negative Prompt", lines=1,
30
- value=client_config['default_neg'],
31
  )
32
  with gr.Row():
33
  sampler = gr.Dropdown(
@@ -90,7 +88,6 @@ def generate(prompt, quality_tags, neg_prompt, seed, scale, width, height, steps
90
  today_count += 1
91
  img = image_from_bytes(img_data)
92
 
93
-
94
  return img, payload
95
 
96
 
@@ -133,8 +130,6 @@ def ui():
133
  _, paras = main_ui()
134
  with gr.TabItem("PNG Info"):
135
  _, png2main, png_items, info, image = util_ui()
136
- with gr.TabItem("Image Browser") as tab:
137
- gal2main, gal_items = img_history_ui(tab)
138
  png2main.click(fn=send_paras,
139
  inputs=[png_items] + paras,
140
  outputs=paras)
@@ -142,13 +137,6 @@ def ui():
142
  js="(x) => { if (x !== null) document.getElementById('client_ui_main-button').click(); "
143
  "return null; }",
144
  inputs=image)
145
- gal2main.click(fn=send_paras,
146
- inputs=[gal_items] + paras,
147
- outputs=paras)
148
- gal2main.click(fn=None,
149
- js="(x) => { if (x !== null) document.getElementById('client_ui_main-button').click(); "
150
- "return null; }",
151
- inputs=gal_items)
152
  image.change(read_info_from_image, inputs=image, outputs=[info, png_items])
153
  return website
154
 
@@ -156,4 +144,4 @@ def ui():
156
  if __name__ == '__main__':
157
  website = ui()
158
  website.queue()
159
- website.launch()
 
3
 
4
  import gradio as gr
5
  from pnginfo import read_info_from_image, send_paras
 
6
 
7
  from utils import set_token, generate_novelai_image, image_from_bytes
 
8
 
9
  today_count = 0
10
  today = datetime.date.today().strftime('%Y-%m-%d')
 
21
  prompt = gr.TextArea(label="Prompt", lines=3)
22
  quality_tags = gr.TextArea(
23
  label="Quality Tags", lines=1,
24
+ value="best quality, amazing quality, very aesthetic, absurdres",
25
  )
26
  neg_prompt = gr.TextArea(
27
  label="Negative Prompt", lines=1,
28
+ value="wide hip,thick thighs,plump,lowres, {bad}, error, fewer, extra, missing, worst quality, jpeg artifacts, bad quality, watermark, unfinished, displeasing, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract],pubic hair",
29
  )
30
  with gr.Row():
31
  sampler = gr.Dropdown(
 
88
  today_count += 1
89
  img = image_from_bytes(img_data)
90
 
 
91
  return img, payload
92
 
93
 
 
130
  _, paras = main_ui()
131
  with gr.TabItem("PNG Info"):
132
  _, png2main, png_items, info, image = util_ui()
 
 
133
  png2main.click(fn=send_paras,
134
  inputs=[png_items] + paras,
135
  outputs=paras)
 
137
  js="(x) => { if (x !== null) document.getElementById('client_ui_main-button').click(); "
138
  "return null; }",
139
  inputs=image)
 
 
 
 
 
 
 
140
  image.change(read_info_from_image, inputs=image, outputs=[info, png_items])
141
  return website
142
 
 
144
  if __name__ == '__main__':
145
  website = ui()
146
  website.queue()
147
+ website.launch(auth=(os.environ.get('account'), os.environ.get('password')))