Spaces:
Sleeping
Sleeping
import os | |
import telebot | |
from huggingface_hub import InferenceClient | |
# Получаем токены из окружения | |
hf_token = os.getenv("HUGGINGFACE_TOKEN") | |
tg_token = os.getenv("TG_TOKEN") | |
bot = telebot.TeleBot(tg_token) | |
client = InferenceClient("sambanovasystems/SambaLingo-Russian-Chat", token=hf_token) | |
def echo_all(message): | |
response = client.chat_completion(messages=[{"role": "user", "content": message.text}]) | |
bot.reply_to(message, response['choices'][0]['message']['content']) | |
bot.polling() | |