Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
@@ -130,17 +130,13 @@ async def img2img(pos_prompt: str, neg_promt: str = "", img = None,model="absolu
|
|
130 |
loop = asyncio.get_running_loop()
|
131 |
client = await loop.run_in_executor(None, get_client, None)
|
132 |
img2img_args = img2img_conf.values()
|
133 |
-
job = client.
|
134 |
-
|
135 |
-
# img = Image.open(img)
|
136 |
-
# img.show()
|
137 |
-
await wait(job)
|
138 |
return job.result()
|
139 |
|
140 |
-
def run_dffusion(pos_prompt: str,neg_promt: str = "",img_url=
|
141 |
"""Runs the diffusion model."""
|
142 |
|
143 |
-
if img_url ==
|
144 |
# Support for text prompts
|
145 |
generated_image = text2img(pos_prompt, neg_promt,model)
|
146 |
else:
|
@@ -151,8 +147,14 @@ def run_dffusion(pos_prompt: str,neg_promt: str = "",img_url= None,model="absolu
|
|
151 |
|
152 |
|
153 |
# AI prediction command
|
154 |
-
@bot.slash_command(name='diffusion',description='AI command to generate images'
|
155 |
-
async def diffusion(ctx,
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
"""
|
157 |
AI command to generate images
|
158 |
"""
|
|
|
130 |
loop = asyncio.get_running_loop()
|
131 |
client = await loop.run_in_executor(None, get_client, None)
|
132 |
img2img_args = img2img_conf.values()
|
133 |
+
job = client.predict(*img2img_args, fn_index=1)
|
|
|
|
|
|
|
|
|
134 |
return job.result()
|
135 |
|
136 |
+
def run_dffusion(pos_prompt: str,neg_promt: str = "",img_url= "",model="absolutereality_v181.safetensors [3d9d4d2b]"):
|
137 |
"""Runs the diffusion model."""
|
138 |
|
139 |
+
if len(img_url) == 0:
|
140 |
# Support for text prompts
|
141 |
generated_image = text2img(pos_prompt, neg_promt,model)
|
142 |
else:
|
|
|
147 |
|
148 |
|
149 |
# AI prediction command
|
150 |
+
@bot.slash_command(name='diffusion',description='AI command to generate images')
|
151 |
+
async def diffusion(ctx,
|
152 |
+
pos_prompt: discord.option(discord.SlashCommandOptionType.string, description="The positive prompt for the image generation."),
|
153 |
+
neg_promt: discord.option(discord.SlashCommandOptionType.string, description="The negative prompt for the image generation.", default=""),
|
154 |
+
img_url= discord.option(discord.SlashCommandOptionType.string, description="The input image for the image generation.", default=""),
|
155 |
+
improve : discord.option(discord.SlashCommandOptionType.string,choices = ["True","False"], description="Improve the results", default="False"),
|
156 |
+
model : discord.option(discord.SlashCommandOptionType.string,choices = models, description="The model to use", default="absolutereality_v181.safetensors [3d9d4d2b]")
|
157 |
+
):
|
158 |
"""
|
159 |
AI command to generate images
|
160 |
"""
|