KvrParaskevi
commited on
Commit
•
8ab4ca8
1
Parent(s):
c411728
Update chatbot.py
Browse files- chatbot.py +10 -12
chatbot.py
CHANGED
@@ -6,6 +6,7 @@ import langchain.globals
|
|
6 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
7 |
import streamlit as st
|
8 |
from langchain_community.llms import HuggingFaceHub
|
|
|
9 |
|
10 |
my_model_id = os.getenv('MODEL_REPO_ID', 'Default Value')
|
11 |
token = os.getenv('HUGGINGFACEHUB_API_TOKEN')
|
@@ -14,18 +15,15 @@ token = os.getenv('HUGGINGFACEHUB_API_TOKEN')
|
|
14 |
def load_model():
|
15 |
#tokenizer = AutoTokenizer.from_pretrained("KvrParaskevi/Hotel-Assistant-Attempt4-Llama-2-7b")
|
16 |
#model = AutoModelForCausalLM.from_pretrained("KvrParaskevi/Hotel-Assistant-Attempt4-Llama-2-7b")
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
huggingfacehub_api_token = token,
|
27 |
-
)
|
28 |
-
return model
|
29 |
|
30 |
def demo_miny_memory(model):
|
31 |
# llm_data = get_Model(hugging_face_key)
|
|
|
6 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
7 |
import streamlit as st
|
8 |
from langchain_community.llms import HuggingFaceHub
|
9 |
+
from transformers import pipeline
|
10 |
|
11 |
my_model_id = os.getenv('MODEL_REPO_ID', 'Default Value')
|
12 |
token = os.getenv('HUGGINGFACEHUB_API_TOKEN')
|
|
|
15 |
def load_model():
|
16 |
#tokenizer = AutoTokenizer.from_pretrained("KvrParaskevi/Hotel-Assistant-Attempt4-Llama-2-7b")
|
17 |
#model = AutoModelForCausalLM.from_pretrained("KvrParaskevi/Hotel-Assistant-Attempt4-Llama-2-7b")
|
18 |
+
|
19 |
+
# Replace 'username/model_name' with your model's identifier on the Hugging Face Model Hub
|
20 |
+
model_identifier = "KvrParaskevi/Hotel-Assistant-Attempt4-Llama-2-7b"
|
21 |
+
task = "text-classification" # Change this to your model's task
|
22 |
+
|
23 |
+
# Load the model using the pipeline
|
24 |
+
model_pipeline = pipeline(task, model=model_identifier)
|
25 |
+
|
26 |
+
return model_pipeline
|
|
|
|
|
|
|
27 |
|
28 |
def demo_miny_memory(model):
|
29 |
# llm_data = get_Model(hugging_face_key)
|