KvrParaskevi
commited on
Update chatbot.py
Browse files- chatbot.py +2 -5
chatbot.py
CHANGED
@@ -1,20 +1,17 @@
|
|
1 |
import os
|
2 |
-
#from langchain import PromptTemplate, HuggingFaceHub, LLMChain
|
3 |
from langchain.memory import ConversationBufferMemory
|
4 |
from langchain.chains import ConversationChain
|
5 |
import langchain.globals
|
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')
|
13 |
|
14 |
@st.cache_resource
|
15 |
def load_model():
|
16 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
17 |
-
model = AutoModelForCausalLM.from_pretrained(
|
18 |
|
19 |
return tokenizer,model
|
20 |
|
|
|
1 |
import os
|
|
|
2 |
from langchain.memory import ConversationBufferMemory
|
3 |
from langchain.chains import ConversationChain
|
4 |
import langchain.globals
|
5 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
6 |
import streamlit as st
|
|
|
|
|
7 |
|
8 |
my_model_id = os.getenv('MODEL_REPO_ID', 'Default Value')
|
9 |
token = os.getenv('HUGGINGFACEHUB_API_TOKEN')
|
10 |
|
11 |
@st.cache_resource
|
12 |
def load_model():
|
13 |
+
tokenizer = AutoTokenizer.from_pretrained(my_model_id)
|
14 |
+
model = AutoModelForCausalLM.from_pretrained(my_model_id)
|
15 |
|
16 |
return tokenizer,model
|
17 |
|