Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,24 +1,22 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from
|
| 3 |
|
| 4 |
-
# Load the model
|
| 5 |
@st.cache_resource
|
| 6 |
def load_model():
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 10 |
-
return tokenizer, model
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
st.title("
|
| 15 |
-
st.write("
|
| 16 |
|
| 17 |
# User input
|
| 18 |
user_input = st.text_input("You: ", placeholder="Type your message here...")
|
| 19 |
|
| 20 |
if user_input:
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from llama_cpp import Llama
|
| 3 |
|
| 4 |
+
# Load the GGUF model
|
| 5 |
@st.cache_resource
|
| 6 |
def load_model():
|
| 7 |
+
model_path = "shanthi-323/lora_model_qnachatbot_cbt_q4_k_m" # Ensure this path matches your uploaded GGUF model file
|
| 8 |
+
return Llama(model_path=model_path)
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
llm = load_model()
|
| 11 |
|
| 12 |
+
st.title("Chat with GGUF Model")
|
| 13 |
+
st.write("Start interacting with your fine-tuned chatbot!")
|
| 14 |
|
| 15 |
# User input
|
| 16 |
user_input = st.text_input("You: ", placeholder="Type your message here...")
|
| 17 |
|
| 18 |
if user_input:
|
| 19 |
+
# Generate a response using llama-cpp-python
|
| 20 |
+
response = llm(user_input)
|
| 21 |
+
st.text_area("Bot:", value=response["choices"][0]["text"].strip(), height=200)
|
| 22 |
+
|