Files changed (1) hide show
  1. README.md +17 -0
README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # โหลดโมเดล LLM (ตัวอย่าง: Mistral 7B)
5
+ generator = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1")
6
+
7
+ def chat_with_ai(prompt):
8
+ response = generator(prompt, max_new_tokens=200, do_sample=True)[0]["generated_text"]
9
+ return response
10
+
11
+ iface = gr.Interface(fn=chat_with_ai,
12
+ inputs=gr.Textbox(lines=5, placeholder="พิมพ์ข้อความของคุณ..."),
13
+ outputs="text",
14
+ title="🧠 AI Proxy Chat",
15
+ allow_flagging="never")
16
+
17
+ iface.launch()