wop commited on
Commit
3eed57f
1 Parent(s): 500eb3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py CHANGED
@@ -13,15 +13,11 @@ from discord import Permissions
13
  from discord.ext import commands
14
  from discord.utils import oauth_url
15
  from gradio_client.utils import QueueError
16
- import base64
17
- import io
18
 
19
  event = Event()
20
 
21
  DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
22
  HF_TOKEN = os.getenv("HF_TOKEN")
23
- API_URL = "https://api-inference.huggingface.co/models/prompthero/openjourney"
24
- headers = {"Authorization": "Bearer " + HF_TOKEN}
25
 
26
  def ask(input_text):
27
  api_url = "https://somerandomapifor-disorc-cause-i-need-it.onrender.com/qa"
@@ -71,23 +67,6 @@ async def ai(ctx, *, input_text: str):
71
  # Reply with the embed
72
  await ctx.reply(result)
73
 
74
- def query(payload):
75
- response = requests.post(API_URL, headers=headers, json=payload)
76
- return response.content
77
-
78
- @bot.command()
79
- async def img(ctx, *, prompt: str):
80
- # Query the API to generate the image
81
- async with ctx.typing():
82
- image_bytes = query({
83
- "inputs": prompt,
84
- })
85
- timestamp = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
86
- filename = f"generated_image_{timestamp}.png"
87
- image_file = discord.File(io.BytesIO(image_bytes), filename=filename)
88
- # Send the image as a file
89
- await ctx.reply(content=prompt, file=image_file)
90
-
91
 
92
  @bot.command()
93
  async def verse(ctx):
 
13
  from discord.ext import commands
14
  from discord.utils import oauth_url
15
  from gradio_client.utils import QueueError
 
 
16
 
17
  event = Event()
18
 
19
  DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
20
  HF_TOKEN = os.getenv("HF_TOKEN")
 
 
21
 
22
  def ask(input_text):
23
  api_url = "https://somerandomapifor-disorc-cause-i-need-it.onrender.com/qa"
 
67
  # Reply with the embed
68
  await ctx.reply(result)
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  @bot.command()
72
  async def verse(ctx):