Spaces:
Running
Running
app17
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ from pydantic import BaseModel
|
|
31 |
import shutil
|
32 |
|
33 |
# Cell 1: Image Classification Model
|
34 |
-
image_pipeline = pipeline(task="image-classification", model="
|
35 |
|
36 |
def predict_image(input_img):
|
37 |
predictions = image_pipeline(input_img)
|
@@ -69,7 +69,7 @@ vectordb = Chroma.from_documents(
|
|
69 |
)
|
70 |
# define retriever
|
71 |
retriever = vectordb.as_retriever(search_type="mmr")
|
72 |
-
|
73 |
Your name is AngryGreta and you are a recycling chatbot with the objective to anwer questions from user in English or Spanish /
|
74 |
Use the following pieces of context to answer the question if the question is related with recycling /
|
75 |
No more than two chunks of context /
|
@@ -83,7 +83,7 @@ question: {question}
|
|
83 |
"""
|
84 |
|
85 |
# Create the chat prompt templates
|
86 |
-
system_prompt = SystemMessagePromptTemplate.from_template(
|
87 |
qa_prompt = ChatPromptTemplate(
|
88 |
messages=[
|
89 |
system_prompt,
|
|
|
31 |
import shutil
|
32 |
|
33 |
# Cell 1: Image Classification Model
|
34 |
+
image_pipeline = pipeline(task="image-classification", model="rocioadlc/TrashNet_ResNet152V2")
|
35 |
|
36 |
def predict_image(input_img):
|
37 |
predictions = image_pipeline(input_img)
|
|
|
69 |
)
|
70 |
# define retriever
|
71 |
retriever = vectordb.as_retriever(search_type="mmr")
|
72 |
+
prompt_template = """
|
73 |
Your name is AngryGreta and you are a recycling chatbot with the objective to anwer questions from user in English or Spanish /
|
74 |
Use the following pieces of context to answer the question if the question is related with recycling /
|
75 |
No more than two chunks of context /
|
|
|
83 |
"""
|
84 |
|
85 |
# Create the chat prompt templates
|
86 |
+
system_prompt = SystemMessagePromptTemplate.from_template(prompt_template)
|
87 |
qa_prompt = ChatPromptTemplate(
|
88 |
messages=[
|
89 |
system_prompt,
|