Spaces:
Runtime error
Runtime error
| import logging | |
| from aiogram import Bot, Dispatcher, executor, types | |
| API_TOKEN = '6184585778:AAEwvLKXANtI-z7LeCmBlZ8PrNXBsf426W4' | |
| logging.basicConfig(level=logging.INFO) | |
| bot = Bot(token=API_TOKEN) | |
| dp = Dispatcher(bot) | |
| async def send_welcome(message: types.Message): | |
| await message.reply("Привет!\nМеня зовут Сенкаро!\nБуду рад провести время с тобой.") | |
| async def send_message(message: types.Message): | |
| await message.reply("Сообщение отправлено!") | |
| if __name__ == '__main__': | |
| executor.start_polling(dp, skip_updates=True) | |
| BOT_TOKEN = '12345:ABC-DEF1234ghIkl-zyx57W2v1u123ew11' | |
| API_URL = "https://api-inference.huggingface.co/models/Meena/table-question-answering-tapas" | |
| # Получаем текст вопроса пользователя | |
| question = message.text | |
| # Формируем JSON-запрос к API модели Meena | |
| payload = { | |
| "inputs": { | |
| "query": question, | |
| "table": {...} # Табличные данные (если есть) | |
| } | |
| } | |
| # Делаем запрос к API и получаем ответ | |
| response = requests.post(API_URL, headers=headers, json=payload) | |
| answer = response.json() | |
| # Отправляем ответ пользователю | |
| await message.answer(answer['answer']) |