testing
Browse files
app.py
CHANGED
@@ -112,12 +112,11 @@ async def generate(ctx: commands.Context, *, args: str = None):
|
|
112 |
try:
|
113 |
logger.info(f"Received prompt: {prompt}")
|
114 |
|
115 |
-
#
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
response = await asyncio.wait_for(call_predict(), timeout=60)
|
121 |
|
122 |
logger.info(f"API response: {response}")
|
123 |
|
|
|
112 |
try:
|
113 |
logger.info(f"Received prompt: {prompt}")
|
114 |
|
115 |
+
# Non-blocking call to predict using asyncio.to_thread
|
116 |
+
response = await asyncio.wait_for(
|
117 |
+
asyncio.to_thread(GRADIO_CLIENT.predict, param_0=prompt, api_name="/predict"),
|
118 |
+
timeout=60
|
119 |
+
)
|
|
|
120 |
|
121 |
logger.info(f"API response: {response}")
|
122 |
|