Spaces:
Running
Running
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from huggingface_hub import hf_hub_download
|
3 |
+
from llama_cpp import Llama
|
4 |
+
|
5 |
+
# Hugging Face model repo details
|
6 |
+
HF_MODEL_REPO = "anush76/unsloth-model"
|
7 |
+
MODEL_FILENAME = "unsloth.Q4_K_M.gguf"
|
8 |
+
|
9 |
+
# Download model from Hugging Face Hub
|
10 |
+
st.sidebar.write("π₯ Downloading model from Hugging Face...")
|
11 |
+
model_path = hf_hub_download(repo_id=HF_MODEL_REPO, filename=MODEL_FILENAME)
|
12 |
+
|
13 |
+
# Load the model with llama-cpp-python
|
14 |
+
st.sidebar.write("π Loading model...")
|
15 |
+
llm = Llama(model_path=model_path)
|
16 |
+
|
17 |
+
# Streamlit UI
|
18 |
+
st.title("π¦₯ Unsloth Chatbot")
|
19 |
+
st.write("π¬ Ask me anything!")
|
20 |
+
|
21 |
+
user_input = st.text_input("You:")
|
22 |
+
if user_input:
|
23 |
+
response = llm(user_input)
|
24 |
+
st.write("π€ Chatbot:", response["choices"][0]["text"])
|
25 |
+
|
26 |
+
st.sidebar.success("β
Model Loaded!")
|