Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,6 @@ from transformers import AutoModelForImageClassification, AutoImageProcessor
|
|
20 |
from langchain import HuggingFacePipeline
|
21 |
|
22 |
|
23 |
-
|
24 |
def image_to_query(image):
|
25 |
"""
|
26 |
input: Image
|
@@ -29,9 +28,6 @@ def image_to_query(image):
|
|
29 |
|
30 |
output: Query for the LLM
|
31 |
"""
|
32 |
-
#image = Image.open(image)
|
33 |
-
#image = cv2.imread(image)
|
34 |
-
#image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
35 |
image = Image.fromarray(image)
|
36 |
|
37 |
model = AutoModelForImageClassification.from_pretrained("nprasad24/bean_classifier", from_tf=True)
|
@@ -121,7 +117,6 @@ def generate_response(rag_chain, query):
|
|
121 |
|
122 |
output: generated response by the llm
|
123 |
"""
|
124 |
-
#return Markdown(rag_chain.invoke(f"{query}"))
|
125 |
return rag_chain.invoke(f"{query}")
|
126 |
|
127 |
def main(image):
|
@@ -132,8 +127,6 @@ def main(image):
|
|
132 |
output = generate_response(chain, query)
|
133 |
return output
|
134 |
|
135 |
-
#main('test2.jpeg')
|
136 |
-
|
137 |
title = "Professor Bean: The Bean Disease Expert"
|
138 |
description = "Professor Bean is an agricultural expert. He will guide you on how to protect your plants from bean diseases"
|
139 |
app = gr.Interface(fn=main,
|
|
|
20 |
from langchain import HuggingFacePipeline
|
21 |
|
22 |
|
|
|
23 |
def image_to_query(image):
|
24 |
"""
|
25 |
input: Image
|
|
|
28 |
|
29 |
output: Query for the LLM
|
30 |
"""
|
|
|
|
|
|
|
31 |
image = Image.fromarray(image)
|
32 |
|
33 |
model = AutoModelForImageClassification.from_pretrained("nprasad24/bean_classifier", from_tf=True)
|
|
|
117 |
|
118 |
output: generated response by the llm
|
119 |
"""
|
|
|
120 |
return rag_chain.invoke(f"{query}")
|
121 |
|
122 |
def main(image):
|
|
|
127 |
output = generate_response(chain, query)
|
128 |
return output
|
129 |
|
|
|
|
|
130 |
title = "Professor Bean: The Bean Disease Expert"
|
131 |
description = "Professor Bean is an agricultural expert. He will guide you on how to protect your plants from bean diseases"
|
132 |
app = gr.Interface(fn=main,
|