Spaces:
Sleeping
Sleeping
File size: 551 Bytes
be0bcf5 0ec1a97 be0bcf5 0ec1a97 be0bcf5 0ec1a97 be0bcf5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import os
import gradio as gr
from huggingface_hub import InferenceClient
# Получаем токен из окружения
hf_token = os.getenv("HUGGINGFACE_TOKEN")
client = InferenceClient("sambanovasystems/SambaLingo-Russian-Chat", token=hf_token)
def respond(message):
response = client.chat_completion(messages=[{"role": "user", "content": message}])
return response['choices'][0]['message']['content']
# Интерфейс Gradio
iface = gr.Interface(fn=respond, inputs="text", outputs="text", title="AI Chat Bot")
iface.launch()
|