Neurolingua commited on
Commit
8cc48a4
1 Parent(s): bc82e06

Update other_function.py

Browse files
Files changed (1) hide show
  1. 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
- CLIENT = InferenceHTTPClient(
65
- api_url="https://detect.roboflow.com",
66
- api_key="oF1aC4b1FBCDtK8CoKx7"
67
- )
68
- result = CLIENT.infer(filepath, model_id="pest-detection-ueoco/1")
69
- return result['predictions'][0]
 
 
 
70
 
71
 
72
  def predict_disease(filepath):
73
- CLIENT = InferenceHTTPClient(
 
74
  api_url="https://classify.roboflow.com",
75
  api_key="oF1aC4b1FBCDtK8CoKx7"
76
  )
77
- result = CLIENT.infer(filepath, model_id="plant-disease-detection-iefbi/1")
78
- return result['predicted_classes'][0]
 
 
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):