Spaces:
Sleeping
Sleeping
mikepastor11
commited on
Commit
•
b2e2d25
1
Parent(s):
1b5f1f5
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,9 @@ DISPLAY_DIALOG_LINES = 6
|
|
34 |
|
35 |
SESSION_STARTED = False
|
36 |
|
37 |
-
MODEL_NAME="deepset/roberta-base-squad2"
|
|
|
|
|
38 |
|
39 |
##################################################################################
|
40 |
def extract_pdf_text(pdf_docs):
|
@@ -107,7 +109,7 @@ def prepare_conversation(vectorstore):
|
|
107 |
|
108 |
##################################################################################
|
109 |
def process_user_question(user_question):
|
110 |
-
|
111 |
|
112 |
# if not SESSION_STARTED:
|
113 |
# print('No Session')
|
@@ -183,7 +185,7 @@ def process_user_question(user_question):
|
|
183 |
#
|
184 |
# results_string += ("<p>" + "-- " + message.content + "</p>")
|
185 |
|
186 |
-
st.write('
|
187 |
|
188 |
from transformers import pipeline
|
189 |
|
@@ -198,9 +200,10 @@ def process_user_question(user_question):
|
|
198 |
# context = "France is a country located in Western Europe. It is bordered by the Atlantic Ocean to the west, the Mediterranean Sea to the south, and Belgium, Luxembourg, Germany, Switzerland, Italy, and Spain to the east and north."
|
199 |
|
200 |
context = "You are an expert Apiarist and answer all questions regarding Honeybees."
|
|
|
201 |
|
202 |
# Ask the question
|
203 |
-
answer = nlp(question=user_question, context=context, model=model_name)
|
204 |
|
205 |
# Print the answer
|
206 |
print(f"Answer: {answer['answer']}")
|
|
|
34 |
|
35 |
SESSION_STARTED = False
|
36 |
|
37 |
+
# MODEL_NAME="deepset/roberta-base-squad2"
|
38 |
+
|
39 |
+
MODEL_NAME="BEE-spoke-data/TinyLlama-3T-1.1bee"
|
40 |
|
41 |
##################################################################################
|
42 |
def extract_pdf_text(pdf_docs):
|
|
|
109 |
|
110 |
##################################################################################
|
111 |
def process_user_question(user_question):
|
112 |
+
|
113 |
|
114 |
# if not SESSION_STARTED:
|
115 |
# print('No Session')
|
|
|
185 |
#
|
186 |
# results_string += ("<p>" + "-- " + message.content + "</p>")
|
187 |
|
188 |
+
st.write(('Question: ' + user_question), unsafe_allow_html=True)
|
189 |
|
190 |
from transformers import pipeline
|
191 |
|
|
|
200 |
# context = "France is a country located in Western Europe. It is bordered by the Atlantic Ocean to the west, the Mediterranean Sea to the south, and Belgium, Luxembourg, Germany, Switzerland, Italy, and Spain to the east and north."
|
201 |
|
202 |
context = "You are an expert Apiarist and answer all questions regarding Honeybees."
|
203 |
+
# context = " "
|
204 |
|
205 |
# Ask the question
|
206 |
+
answer = nlp(question= ('Question: '+user_question), context=context, model=model_name)
|
207 |
|
208 |
# Print the answer
|
209 |
print(f"Answer: {answer['answer']}")
|