Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,12 @@ event = Event()
|
|
18 |
|
19 |
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
20 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
async def wait(job):
|
23 |
while not job.done():
|
24 |
await asyncio.sleep(0.2)
|
@@ -44,9 +49,7 @@ async def uptime(ctx):
|
|
44 |
@bot.command()
|
45 |
async def ai(ctx, *, input_text: str):
|
46 |
"""Ask our AI model a question. (Session resets every 1 message!)"""
|
47 |
-
|
48 |
-
result = client.predict(input_text, 0.9, 2000, 0.9, 1.2, api_name="/chat")
|
49 |
-
result = result[:-4]
|
50 |
|
51 |
# Create an embed with the AI's response
|
52 |
embed = discord.Embed(title="AI Response", description=result, color=discord.Color.green())
|
|
|
18 |
|
19 |
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
20 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
21 |
+
def ask(input_text):
|
22 |
+
client = Client("https://wop-xxx-opengpt.hf.space/")
|
23 |
+
result = client.predict(input_text, 0.9, 2000, 0.9, 1.2, api_name="/chat")
|
24 |
+
result = result[:-4]
|
25 |
+
return result
|
26 |
+
|
27 |
async def wait(job):
|
28 |
while not job.done():
|
29 |
await asyncio.sleep(0.2)
|
|
|
49 |
@bot.command()
|
50 |
async def ai(ctx, *, input_text: str):
|
51 |
"""Ask our AI model a question. (Session resets every 1 message!)"""
|
52 |
+
result = ask(input_text)
|
|
|
|
|
53 |
|
54 |
# Create an embed with the AI's response
|
55 |
embed = discord.Embed(title="AI Response", description=result, color=discord.Color.green())
|