anush76 commited on
Commit
54229c5
Β·
verified Β·
1 Parent(s): 9cbfabc

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
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!")