Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,9 +31,18 @@ def save_to_s3(image_data, payload, file_name):
|
|
31 |
|
32 |
|
33 |
# Function to handle the NovelAI API request
|
34 |
-
def generate_novelai_image(input_text, quality_tags, seed, negative_prompt, scale, sampler):
|
35 |
jwt_token = os.environ.get('NAI_API_KEY')
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
# Check if quality tags are provided and append to input
|
38 |
final_input = input_text
|
39 |
if quality_tags:
|
@@ -60,8 +69,8 @@ def generate_novelai_image(input_text, quality_tags, seed, negative_prompt, scal
|
|
60 |
"input": final_input,
|
61 |
"model": "nai-diffusion-3",
|
62 |
"parameters": {
|
63 |
-
"width":
|
64 |
-
"height":
|
65 |
"scale": scale,
|
66 |
"sampler": sampler,
|
67 |
"steps": 28,
|
@@ -120,6 +129,7 @@ iface = gr.Interface(
|
|
120 |
gr.Slider(minimum=-1, maximum=2**32 - 1, step=1, value=-1, label="Seed"),
|
121 |
gr.Textbox(label="Negative Prompt", value="nsfw, 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]"),
|
122 |
gr.Slider(minimum=1, maximum=20, step=1, value=5, label="Scale"),
|
|
|
123 |
gr.Dropdown(
|
124 |
choices=[
|
125 |
"k_euler", "k_euler_ancestral", "k_dpmpp_2s_ancestral",
|
|
|
31 |
|
32 |
|
33 |
# Function to handle the NovelAI API request
|
34 |
+
def generate_novelai_image(input_text, quality_tags, seed, negative_prompt, scale, ratio, sampler):
|
35 |
jwt_token = os.environ.get('NAI_API_KEY')
|
36 |
+
if ratio == "Landscape (1216x832)":
|
37 |
+
width = 1216
|
38 |
+
height = 832
|
39 |
+
elif ratio == "Square (1024x1024)":
|
40 |
+
width = 1024
|
41 |
+
height = 1024
|
42 |
+
elif ratio == "Portrait (832x1216)":
|
43 |
+
width = 832
|
44 |
+
height = 1216
|
45 |
+
|
46 |
# Check if quality tags are provided and append to input
|
47 |
final_input = input_text
|
48 |
if quality_tags:
|
|
|
69 |
"input": final_input,
|
70 |
"model": "nai-diffusion-3",
|
71 |
"parameters": {
|
72 |
+
"width": width,
|
73 |
+
"height": height,
|
74 |
"scale": scale,
|
75 |
"sampler": sampler,
|
76 |
"steps": 28,
|
|
|
129 |
gr.Slider(minimum=-1, maximum=2**32 - 1, step=1, value=-1, label="Seed"),
|
130 |
gr.Textbox(label="Negative Prompt", value="nsfw, 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]"),
|
131 |
gr.Slider(minimum=1, maximum=20, step=1, value=5, label="Scale"),
|
132 |
+
gr.Radio(choices=["Landscape (1216x832)", "Square (1024x1024)", "Portrait (832x1216)"]),
|
133 |
gr.Dropdown(
|
134 |
choices=[
|
135 |
"k_euler", "k_euler_ancestral", "k_dpmpp_2s_ancestral",
|