qwo1 / app.py
Rueslan's picture
Create app.py
e210428 verified
raw
history blame contribute delete
821 Bytes
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "mergekit-community/qwen-2.5-o1.like-pluse"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def generate_response(prompt):
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=150, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response
iface = gr.Interface(
fn=generate_response,
inputs=gr.inputs.Textbox(lines=2, placeholder="Введите ваш вопрос"),
outputs="text",
title="Qwen-2.5-O1.Like-Pluse",
description="Интерфейс для взаимодействия с моделью Qwen-2.5-O1.Like-Pluse"
)
iface.launch()