Spaces:
Sleeping
Sleeping
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() | |