Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,8 @@ client = OpenAI(
|
|
| 9 |
api_key=HF_TOKEN,
|
| 10 |
)
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
SYSTEM = "Sen MAIND AI'sin. Kısa, net ve yardımcı cevap ver."
|
| 15 |
|
|
@@ -21,7 +22,7 @@ def llm_reply(user_text: str) -> str:
|
|
| 21 |
{"role": "user", "content": user_text},
|
| 22 |
],
|
| 23 |
temperature=0.7,
|
| 24 |
-
max_tokens=
|
| 25 |
)
|
| 26 |
return resp.choices[0].message.content or ""
|
| 27 |
|
|
@@ -39,9 +40,14 @@ def chat_fn(message, history):
|
|
| 39 |
return history
|
| 40 |
|
| 41 |
with gr.Blocks(title="MaindAI") as demo:
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
chatbot = gr.Chatbot(value=[])
|
| 44 |
-
msg = gr.Textbox(placeholder="Sor...")
|
|
|
|
| 45 |
msg.submit(chat_fn, [msg, chatbot], chatbot)
|
| 46 |
|
| 47 |
demo.launch()
|
|
|
|
| 9 |
api_key=HF_TOKEN,
|
| 10 |
)
|
| 11 |
|
| 12 |
+
# Ücretsiz/hafif model (hf-inference)
|
| 13 |
+
MODEL_ID = "TinyLlama/TinyLlama-1.1B-Chat-v1.0:hf-inference"
|
| 14 |
|
| 15 |
SYSTEM = "Sen MAIND AI'sin. Kısa, net ve yardımcı cevap ver."
|
| 16 |
|
|
|
|
| 22 |
{"role": "user", "content": user_text},
|
| 23 |
],
|
| 24 |
temperature=0.7,
|
| 25 |
+
max_tokens=256,
|
| 26 |
)
|
| 27 |
return resp.choices[0].message.content or ""
|
| 28 |
|
|
|
|
| 40 |
return history
|
| 41 |
|
| 42 |
with gr.Blocks(title="MaindAI") as demo:
|
| 43 |
+
# LOGO (dosya adı repo kökünde: logo.png)
|
| 44 |
+
gr.Image("logo.png", show_label=False, height=120)
|
| 45 |
+
|
| 46 |
+
gr.Markdown("## 💙 MaindAI — Chat")
|
| 47 |
+
|
| 48 |
chatbot = gr.Chatbot(value=[])
|
| 49 |
+
msg = gr.Textbox(placeholder="Sor...", show_label=False)
|
| 50 |
+
|
| 51 |
msg.submit(chat_fn, [msg, chatbot], chatbot)
|
| 52 |
|
| 53 |
demo.launch()
|