Вот мой код: import logging
import asyncio
from telegram import Update
from telegram.ext import ApplicationBuilder, CommandHandler, MessageHandler, filters, ContextTypes
from gradio_client import Client

# Установите токен вашего бота
TELEGRAM_TOKEN = '<TRUFFLEHOG_REDACTED_TELEGRAMBOTTOKEN>'

# Создаем клиент для работы с Gradio
client = Client("yuntian-deng/ChatGPT")

# Настройка логирования
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)

# Функция для обработки команды /start
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
    await update.message.reply_text('Привет! Как я могу помочь?')

# Функция для обработки текстовых сообщений
async def chat(update: Update, context: ContextTypes.DEFAULT_TYPE):
    user_message = update.message.text

    # Отправка запроса к Gradio API
    result = client.predict(
        inputs=user_message,
        api_name="/predict"
    )

    bot_reply = result[0][0]  # Получаем ответ от сервиса
    await update.message.reply_text(bot_reply)

# Основная функция, инициализирующая бота
async def main():
    app = ApplicationBuilder().token(TELEGRAM_TOKEN).build()

    app.add_handler(CommandHandler("start", start))
    app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, chat))

    logging.info("Бот запущен...")
    await app.run_polling()

# Запуск бота
if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    if loop.is_running():
        # Проверяем, запущен ли существующий цикл событий
        print("Запуск в уже запущенном цикле событий.")
        loop.create_task(main())
    else:
        # Запуск основного цикла
        loop.run_until_complete(main()) А вот ошибка: Loaded as API: https://yuntian-deng-chatgpt.hf.space ✔
2024-12-13 23:04:46,974 - root - INFO - Бот запущен...
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/telegram/ext/_application.py", line 1079, in __run
    loop.run_until_complete(self.initialize())
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/base_events.py", line 629, in run_until_complete
    self._check_running()
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/base_events.py", line 588, in _check_running
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/telegram/ext/_application.py", line 1104, in __run
    loop.run_until_complete(self.shutdown())
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/base_events.py", line 629, in run_until_complete
    self._check_running()
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/base_events.py", line 588, in _check_running
    raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
    start(fakepyfile,mainpyfile)
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
    exec(open(mainpyfile).read(),  __main__.__dict__)
  File "<string>", line 52, in <module>
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "<string>", line 41, in main
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/telegram/ext/_application.py", line 881, in run_polling
    return self.__run(
           ^^^^^^^^^^^
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/site-packages/telegram/ext/_application.py", line 1109, in __run
    loop.close()
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/unix_events.py", line 68, in close
    super().close()
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.11/asyncio/selector_events.py", line 88, in close
    raise RuntimeError("Cannot close a running event loop")
RuntimeError: Cannot close a running event loop
sys:1: RuntimeWarning: coroutine 'Application.shutdown' was never awaited
sys:1: RuntimeWarning: coroutine 'Application.initialize' was never awaited

[Program finished] Я работаю с телефона с Pydroid 3