Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,31 +1,22 @@
|
|
| 1 |
-
import os
|
| 2 |
import gradio as gr
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
from llama_cpp import Llama
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
print("⏳ মডেল লোড হচ্ছে, এটি প্রথমবার ২-৩ মিনিট সময় নিতে পারে...")
|
| 8 |
model_path = hf_hub_download(
|
| 9 |
repo_id="saiful-ai-dev/MotionMindX",
|
| 10 |
filename="Qwen2.5-3B-Instruct-Q4_K_M.gguf"
|
| 11 |
)
|
| 12 |
|
| 13 |
-
# মডেল সেটআপ
|
| 14 |
llm = Llama(model_path=model_path, n_ctx=2048, n_threads=2)
|
| 15 |
|
| 16 |
def respond(message, history):
|
| 17 |
-
|
| 18 |
-
prompt = f"<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{message}<|im_end|>\n<|im_start|>assistant\n"
|
| 19 |
-
|
| 20 |
response = llm(prompt, max_tokens=512, stop=["<|im_end|>"], echo=False)
|
| 21 |
return response['choices'][0]['text']
|
| 22 |
|
| 23 |
-
|
| 24 |
-
demo = gr.ChatInterface(
|
| 25 |
-
respond,
|
| 26 |
-
title="Motion Mind X 🚀",
|
| 27 |
-
description="SSC/HSC শিক্ষার্থীদের জন্য এআই টিউটর"
|
| 28 |
-
)
|
| 29 |
|
| 30 |
if __name__ == "__main__":
|
| 31 |
demo.launch()
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
from llama_cpp import Llama
|
| 4 |
|
| 5 |
+
# তোমার নিজের রিপো থেকে GGUF মডেল লোড
|
|
|
|
| 6 |
model_path = hf_hub_download(
|
| 7 |
repo_id="saiful-ai-dev/MotionMindX",
|
| 8 |
filename="Qwen2.5-3B-Instruct-Q4_K_M.gguf"
|
| 9 |
)
|
| 10 |
|
| 11 |
+
# মডেল সেটআপ (threads বাড়িয়ে দিলাম স্পিড পাওয়ার জন্য)
|
| 12 |
llm = Llama(model_path=model_path, n_ctx=2048, n_threads=2)
|
| 13 |
|
| 14 |
def respond(message, history):
|
| 15 |
+
prompt = f"<|im_start|>system\nYou are Motion Mind X, a helpful tutor.<|im_end|>\n<|im_start|>user\n{message}<|im_end|>\n<|im_start|>assistant\n"
|
|
|
|
|
|
|
| 16 |
response = llm(prompt, max_tokens=512, stop=["<|im_end|>"], echo=False)
|
| 17 |
return response['choices'][0]['text']
|
| 18 |
|
| 19 |
+
demo = gr.ChatInterface(respond, title="Motion Mind X 🚀 (GGUF Mode)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
if __name__ == "__main__":
|
| 22 |
demo.launch()
|