Spaces:
Runtime error
Runtime error
Update app.py
Browse files64 unmodified lines656667686970717273747576777879808182838464 unmodified linesif ctx.author.id == bot.user.id:returntry:# Acknowledge the command immediately - This is the discord message after the command / is called ##await ctx.send(f"Processing request: {prompt}")loop = asyncio.get_running_loop()client = await loop.run_in_executor(None, get_client, None)job = client.submit(prompt, api_name="/predict") ## /predict can be used for gradio interface ##await wait(job)try:job.result()response = job.outputs()[-1]await ctx.send(f"```{truncate_response(response)}```") # Send the LLM responseexcept QueueError:await ctx.send("The gradio space powering this bot is really busy! Please try again later!")except Exception as e:print(f"{e}")64 unmodified lines6566676869707172737475767778798081828384858687888990919293949564 unmodified linesif ctx.author.id == bot.user.id:returntry:message = await ctx.send("Creating thread...")# User triggered bot via !echoif ctx.message.content:prompt = ctx.message.content.replace(f"{bot.command_prefix}echo", "").strip()thread = await message.create_thread(name=prompt)loop = asyncio.get_running_loop()client = await loop.run_in_executor(None, get_client, None)job = client.submit(prompt, api_name="/predict")await wait(job)try:job.result()response = job.outputs()[-1]await thread.send(truncate_response(response))thread_to_client[thread.id] = clientthread_to_user[thread.id] = ctx.author.idexcept QueueError:await thread.send("The gradio space powering this bot is really busy! Please try again later!")except Exception as e:print(f"{e}")
app.py+16-5