-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Craiyon API Image generator PR #156
Open
Neptuneia
wants to merge
14
commits into
v1rbox:main
Choose a base branch
from
Neptuneia:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bcd4703
gen.py uwu
Neptuneia 40e46b2
blocked prompts for gen.py uwu
Neptuneia e4a79fc
added notepad
Neptuneia 4894080
updated with EVEN BETTER code
Neptuneia 7ad4754
Update and rename blocked_prompts.py to __blocked_prompts.py
Neptuneia fe84f5e
sdwkjhfsjkhsjkdhfj
Neptuneia 4419ce9
delete to move (idk how ot make files in the github web)
Neptuneia fb7a8c0
moved it here uwu
Neptuneia 5486fa7
updated the import for the new file location of blocked prompts UwU
Neptuneia 6a31796
fixed bypass for blocked prompts
Neptuneia 219417f
Update gen.py
Neptuneia fb5d45a
Added craiyon to dependencies
xsnowstorm 6a46fff
Beautified
xsnowstorm a4467c0
water bottle
Neptuneia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from io import BytesIO | ||
import base64 | ||
import time | ||
from craiyon import Craiyon | ||
from bot.commands.fun.__blocked_prompts import blocked | ||
from bot.config import Config, Embed | ||
from bot.base import Command | ||
|
||
|
||
class cmd(Command): | ||
""" A discord command instance. """ | ||
# | ||
name = "gen" | ||
usage = "gen <*prompt>" | ||
description = "Uses the Craiyon AI API to generate an image with a given prompt" | ||
|
||
async def execute(self, arguments, message) -> None: | ||
prompt = arguments[0] | ||
if prompt.lower() in blocked: | ||
await message.channel.send("I'm not generating that you meanie >:( It's NSFW! Try something else!") | ||
return | ||
|
||
loadingE = Embed(title=f"Image {prompt} currently generating, please wait a moment!") | ||
loadingM = await message.channel.send(embed=loadingE) | ||
|
||
generator = Craiyon() | ||
result = generator.generate(prompt) | ||
images = result.images | ||
embed = Embed(title="Here is the generated image") | ||
embed.set_image(url=images[0]) | ||
|
||
await loadingM.delete() | ||
await message.channel.send(embed=embed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
blocked = [ | ||
"nsfw", | ||
"pussy", | ||
"gore", | ||
"murder", | ||
"penis", | ||
"cat", | ||
"emacs", | ||
"porn", | ||
"vagina", | ||
"dick", | ||
"sex", | ||
"intercourse", | ||
"bondage", | ||
"bdsm", | ||
"fetish", | ||
"kink", | ||
"pegging", | ||
"peg", | ||
"anal", | ||
"vaginal", | ||
"erotic", | ||
"notepad | ||
|
||
] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.