tommy24 commited on
Commit
3f45d48
·
1 Parent(s): 9469195

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -229,7 +229,7 @@ def classify(UserInput, Image, Textbox2, Textbox3):
229
  print(f'Maximum Prediction: {max_label} with a value of {max_rounded_prediction}')
230
 
231
  time.sleep(1)
232
- if rounded_value > 0.5:
233
  print("\nWays to dispose of this waste: " + max_label)
234
  messages.append({"role": "user", "content": content + " " + max_label})
235
 
@@ -246,9 +246,9 @@ def classify(UserInput, Image, Textbox2, Textbox3):
246
  reply = response["choices"][0]["message"]["content"]
247
  messages.append({"role": "assistant", "content": reply})
248
 
249
- output.append({"Mode": "Image", "type": max_label, "prediction_value": rounded_value, "content": reply})
250
- elif rounded_value < 0.5:
251
- output.append({"Mode": "Image", "type": "Not predictable", "prediction_value": rounded_value, "content": "Seems like the prediction rate is too low due to that won't be able to predict the type of material. Try again with a cropped image or different one."})
252
 
253
  return output
254
 
 
229
  print(f'Maximum Prediction: {max_label} with a value of {max_rounded_prediction}')
230
 
231
  time.sleep(1)
232
+ if max_rounded_prediction > 0.5:
233
  print("\nWays to dispose of this waste: " + max_label)
234
  messages.append({"role": "user", "content": content + " " + max_label})
235
 
 
246
  reply = response["choices"][0]["message"]["content"]
247
  messages.append({"role": "assistant", "content": reply})
248
 
249
+ output.append({"Mode": "Image", "type": max_label, "prediction_value": max_rounded_prediction, "content": reply})
250
+ elif max_rounded_prediction < 0.5:
251
+ output.append({"Mode": "Image", "type": "Not predictable", "prediction_value": max_rounded_prediction, "content": "Seems like the prediction rate is too low due to that won't be able to predict the type of material. Try again with a cropped image or different one."})
252
 
253
  return output
254