abspython commited on
Commit
2e4e4e1
·
1 Parent(s): 6275e03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -28,13 +28,12 @@ def get_img_prediction(imgpath):
28
  return y_pred_pro[0].tolist()
29
 
30
 
31
- def get_text_prediction(text,imgpath):
32
- if text == '':
33
- result = reader.readtext(imgpath,paragraph="False")
34
- text = []
35
- for i in result:
36
- text.append(i[1])
37
- text = " ".join(text)
38
  t_pred = get_inference(text)[0]
39
  t_pred_c = []
40
  for c in t_pred:
@@ -70,7 +69,7 @@ if image_file is not None:
70
 
71
  with st.spinner('Predicting Label..'):
72
  i_pred = get_img_prediction(temp_file.name)
73
- t_pred = get_text_prediction('',temp_file.name)
74
  y_pred_both = pred_label_mean(i_pred,t_pred)
75
  y_pred = y_pred_both.index(max(y_pred_both))
76
 
 
28
  return y_pred_pro[0].tolist()
29
 
30
 
31
+ def get_text_prediction(imgpath):
32
+ result = reader.readtext(imgpath,paragraph="False")
33
+ text = []
34
+ for i in result:
35
+ text.append(i[1])
36
+ text = " ".join(text)
 
37
  t_pred = get_inference(text)[0]
38
  t_pred_c = []
39
  for c in t_pred:
 
69
 
70
  with st.spinner('Predicting Label..'):
71
  i_pred = get_img_prediction(temp_file.name)
72
+ t_pred = get_text_prediction(temp_file.name)
73
  y_pred_both = pred_label_mean(i_pred,t_pred)
74
  y_pred = y_pred_both.index(max(y_pred_both))
75