not-lain commited on
Commit
5637bed
·
1 Parent(s): 7d3776b

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (1) hide show
  1. app.py +11 -9
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.submit(*img2img_args, fn_index=1)
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= None,model="absolutereality_v181.safetensors [3d9d4d2b]"):
141
  """Runs the diffusion model."""
142
 
143
- if img_url == None:
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, pos_prompt: str="",neg_promt: str = "", img_url= None,improve : Literal["True","False"] = "False",model : models = "absolutereality_v181.safetensors [3d9d4d2b]"):
 
 
 
 
 
 
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
  """