app.py / README.md
Manii-cmd-1's picture
Create README.md
7c711ca verified
|
raw
history blame
657 Bytes

import gradio as gr from transformers import pipeline

โหลดโมเดล LLM (ตัวอย่าง: Mistral 7B)

generator = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1")

def chat_with_ai(prompt): response = generator(prompt, max_new_tokens=200, do_sample=True)[0]["generated_text"] return response

iface = gr.Interface(fn=chat_with_ai, inputs=gr.Textbox(lines=5, placeholder="พิมพ์ข้อความของคุณ..."), outputs="text", title="🧠 AI Proxy Chat", allow_flagging="never")

iface.launch()