Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
# Завантаження моделі | |
generator = pipeline("text-generation", model="EleutherAI/gpt-neo-1.3B") | |
# Функція для генерації відповіді | |
def chat_with_npc(user_input): | |
response = generator(user_input, max_length=100, do_sample=True, temperature=0.7) | |
return response[0]["generated_text"] | |
# Інтерфейс Gradio | |
interface = gr.Interface( | |
fn=chat_with_npc, | |
inputs="text", | |
outputs="text", | |
title="NPC Помічник", | |
description="Віртуальний помічник для спілкування та підтримки." | |
) | |
# Запуск програми | |
if __name__ == "__main__": | |
interface.launch() | |