Spaces:
Sleeping
Sleeping
Neurolingua
commited on
Update other_function.py
Browse files- other_function.py +15 -9
other_function.py
CHANGED
@@ -61,21 +61,27 @@ class ConversationBufferMemory:
|
|
61 |
def get_memory(self):
|
62 |
return self.memory
|
63 |
def predict_pest(filepath):
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
70 |
|
71 |
|
72 |
def predict_disease(filepath):
|
73 |
-
|
|
|
74 |
api_url="https://classify.roboflow.com",
|
75 |
api_key="oF1aC4b1FBCDtK8CoKx7"
|
76 |
)
|
77 |
-
|
78 |
-
|
|
|
|
|
79 |
|
80 |
|
81 |
def convert_img(url, account_sid, auth_token):
|
|
|
61 |
def get_memory(self):
|
62 |
return self.memory
|
63 |
def predict_pest(filepath):
|
64 |
+
try:
|
65 |
+
CLIENT = InferenceHTTPClient(
|
66 |
+
api_url="https://detect.roboflow.com",
|
67 |
+
api_key="oF1aC4b1FBCDtK8CoKx7"
|
68 |
+
)
|
69 |
+
result = CLIENT.infer(filepath, model_id="pest-detection-ueoco/1")
|
70 |
+
return result['predictions'][0]
|
71 |
+
except:
|
72 |
+
return None
|
73 |
|
74 |
|
75 |
def predict_disease(filepath):
|
76 |
+
try:
|
77 |
+
CLIENT = InferenceHTTPClient(
|
78 |
api_url="https://classify.roboflow.com",
|
79 |
api_key="oF1aC4b1FBCDtK8CoKx7"
|
80 |
)
|
81 |
+
result = CLIENT.infer(filepath, model_id="plant-disease-detection-iefbi/1")
|
82 |
+
return result['predicted_classes'][0]
|
83 |
+
except:
|
84 |
+
return None
|
85 |
|
86 |
|
87 |
def convert_img(url, account_sid, auth_token):
|