jsilbersky's picture
Update app.py
8072bac verified
raw
history blame
650 Bytes
import gradio as gr
from transformers import pipeline
# Načteme malý model pro odpovídání
chatbot = pipeline("text-generation", model="microsoft/phi-2")
def chat(user_input):
response = chatbot(user_input, max_length=200, do_sample=True, temperature=0.7)
return response[0]['generated_text']
# Uděláme jednoduché webové rozhraní
interface = gr.Interface(fn=chat,
inputs="text",
outputs="text",
title="Tvůj AI učitel angličtiny",
description="Napiš otázku anglicky a AI ti odpoví.")
# Spustíme aplikaci
interface.launch()