Sync with main #4
22
src/main.py
22
src/main.py
@ -30,14 +30,23 @@ async def on_ready():
|
|||||||
@app_commands.describe(
|
@app_commands.describe(
|
||||||
prompt="What should be generated?",
|
prompt="What should be generated?",
|
||||||
undesired_prompt="What should be avoided? (optional)",
|
undesired_prompt="What should be avoided? (optional)",
|
||||||
orientation="portrait or landscape (Standard: portrait)"
|
orientation="portrait or landscape (Standard: portrait)",
|
||||||
|
seed="Optional seed (integer). If empty, a random one will be generated"
|
||||||
)
|
)
|
||||||
async def generate(
|
async def generate(
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
undesired_prompt: str = "",
|
undesired_prompt: str = "",
|
||||||
orientation: str = "portrait"
|
orientation: str = "portrait",
|
||||||
|
seed: int = None
|
||||||
):
|
):
|
||||||
|
|
||||||
|
default_negative = (
|
||||||
|
"blurry, lowres, error, film grain, scan artifacts, worst quality, bad quality, jpeg artifacts, "
|
||||||
|
"very displeasing, chromatic aberration, multiple views, logo, too many watermarks, white blank page, "
|
||||||
|
"blank page, watermarks, watermark, text, "
|
||||||
|
)
|
||||||
|
|
||||||
if interaction.channel.id != ALLOWED_CHANNEL_ID:
|
if interaction.channel.id != ALLOWED_CHANNEL_ID:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
"This command isn't allowed here.",
|
"This command isn't allowed here.",
|
||||||
@ -51,7 +60,7 @@ async def generate(
|
|||||||
await interaction.followup.send(f"Prompt too long! Maximum {MAX_PROMPT_LENGTH} chars allowed.")
|
await interaction.followup.send(f"Prompt too long! Maximum {MAX_PROMPT_LENGTH} chars allowed.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(negative) > MAX_PROMPT_LENGTH:
|
if len(default_negative + undesired_prompt.strip()) > MAX_PROMPT_LENGTH:
|
||||||
await interaction.followup.send(f"Negative Prompt too long! Maximum {MAX_PROMPT_LENGTH} chars allowed.")
|
await interaction.followup.send(f"Negative Prompt too long! Maximum {MAX_PROMPT_LENGTH} chars allowed.")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -63,12 +72,7 @@ async def generate(
|
|||||||
else:
|
else:
|
||||||
width, height = 832, 1216
|
width, height = 832, 1216
|
||||||
|
|
||||||
default_negative = (
|
if seed is None:
|
||||||
"blurry, lowres, error, film grain, scan artifacts, worst quality, bad quality, jpeg artifacts, "
|
|
||||||
"very displeasing, chromatic aberration, multiple views, logo, too many watermarks, white blank page, "
|
|
||||||
"blank page, watermarks, watermark, text, "
|
|
||||||
)
|
|
||||||
|
|
||||||
seed = random.randint(0, 2**32 - 1)
|
seed = random.randint(0, 2**32 - 1)
|
||||||
|
|
||||||
# API-Payload zusammenbauen
|
# API-Payload zusammenbauen
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user