Spaces:
Runtime error
Runtime error
File size: 650 Bytes
5df5de8 8072bac 6905010 8072bac 0877c16 8072bac 0877c16 8072bac 6905010 8072bac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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()
|