R1000 commited on
Commit
3cfe716
·
verified ·
1 Parent(s): a1e9655

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -21
app.py DELETED
@@ -1,21 +0,0 @@
1
- import gradio as gr
2
- import requests
3
-
4
- OLLAMA_API = "http://localhost:11434/api/chat"
5
-
6
- def chat_fn(message, history):
7
- messages = [{"role": "user", "content": message}]
8
- payload = {
9
- "model": "qwen2.5-coder:3b", # หรือเปลี่ยน model ตามที่ pull มา
10
- "messages": messages
11
- }
12
- try:
13
- response = requests.post(OLLAMA_API, json=payload)
14
- response.raise_for_status()
15
- data = response.json()
16
- reply = data.get("message", {}).get("content", "No response.")
17
- return reply
18
- except Exception as e:
19
- return f"Error: {e}"
20
-
21
- gr.ChatInterface(chat_fn, title="Chat with Ollama Model").launch()