Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,14 +22,14 @@ client = discord.Client(intents=intents)
|
|
| 22 |
tree = app_commands.CommandTree(client)
|
| 23 |
|
| 24 |
|
| 25 |
-
async def generate_image_async(prompt, aspect_ratio):
|
| 26 |
global glif_token_id
|
| 27 |
global GLIF_API_TOKEN
|
| 28 |
global glif_tokens_tried
|
| 29 |
global no_of_accounts
|
| 30 |
payload = {
|
| 31 |
"id": "cm3ugmzv2002gnckiosrwk6xi",
|
| 32 |
-
"inputs": [prompt, aspect_ratio],
|
| 33 |
}
|
| 34 |
headers = {"Authorization": f"Bearer {GLIF_API_TOKEN}"}
|
| 35 |
|
|
@@ -80,11 +80,12 @@ async def generate_command(
|
|
| 80 |
interaction: discord.Interaction,
|
| 81 |
prompt: str,
|
| 82 |
aspect_ratio: app_commands.Choice[str],
|
|
|
|
| 83 |
):
|
| 84 |
try:
|
| 85 |
await interaction.response.defer()
|
| 86 |
|
| 87 |
-
image_url_or_error = await generate_image_async(prompt, aspect_ratio.value)
|
| 88 |
# await interaction.response.send_message(f"Error:{image_url_or_error}")
|
| 89 |
if image_url_or_error:
|
| 90 |
# if image_url_or_error.startswith("http"):
|
|
|
|
| 22 |
tree = app_commands.CommandTree(client)
|
| 23 |
|
| 24 |
|
| 25 |
+
async def generate_image_async(prompt, aspect_ratio, realism):
|
| 26 |
global glif_token_id
|
| 27 |
global GLIF_API_TOKEN
|
| 28 |
global glif_tokens_tried
|
| 29 |
global no_of_accounts
|
| 30 |
payload = {
|
| 31 |
"id": "cm3ugmzv2002gnckiosrwk6xi",
|
| 32 |
+
"inputs": [prompt, aspect_ratio, str(realism).lower()],
|
| 33 |
}
|
| 34 |
headers = {"Authorization": f"Bearer {GLIF_API_TOKEN}"}
|
| 35 |
|
|
|
|
| 80 |
interaction: discord.Interaction,
|
| 81 |
prompt: str,
|
| 82 |
aspect_ratio: app_commands.Choice[str],
|
| 83 |
+
realism:bool,
|
| 84 |
):
|
| 85 |
try:
|
| 86 |
await interaction.response.defer()
|
| 87 |
|
| 88 |
+
image_url_or_error = await generate_image_async(prompt, aspect_ratio.value, realism)
|
| 89 |
# await interaction.response.send_message(f"Error:{image_url_or_error}")
|
| 90 |
if image_url_or_error:
|
| 91 |
# if image_url_or_error.startswith("http"):
|