Delete app.py
Browse files
app.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 3 |
-
|
| 4 |
-
# Загружаем модель
|
| 5 |
-
model_id = "microsoft/Phi-4-mini-instruct"
|
| 6 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 7 |
-
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 8 |
-
|
| 9 |
-
# Создаем пайплайн
|
| 10 |
-
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=200)
|
| 11 |
-
|
| 12 |
-
# Функция генерации текста
|
| 13 |
-
def chat(input_text):
|
| 14 |
-
result = pipe(input_text)[0]['generated_text']
|
| 15 |
-
return result
|
| 16 |
-
|
| 17 |
-
# Интерфейс Gradio
|
| 18 |
-
iface = gr.Interface(fn=chat,
|
| 19 |
-
inputs=gr.Textbox(lines=4, placeholder="Спроси меня что-нибудь..."),
|
| 20 |
-
outputs="text",
|
| 21 |
-
title="💬 Chat с Phi-4-mini-instruct")
|
| 22 |
-
|
| 23 |
-
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|