JosueElias commited on
Commit
6432af5
·
1 Parent(s): 21ead8a

Handling errors.

Browse files
Files changed (2) hide show
  1. app.py +12 -4
  2. mi_clase.py +2 -2
app.py CHANGED
@@ -27,8 +27,16 @@ try:
27
  "D":d,
28
  "E":e
29
  }
30
- answer = pipeline.give_the_best_answer(mi_dict)
31
- st.write(mi_dict)
32
- st.write(answer)
 
 
 
 
 
 
33
  except:
34
- st.error("Your question doesn't have the required format. Please, correct it.")
 
 
 
27
  "D":d,
28
  "E":e
29
  }
30
+
31
+ try:
32
+ answer = pipeline.give_the_best_answer(mi_dict)
33
+ st.write(mi_dict)
34
+ st.write(answer)
35
+ except Exception as e:
36
+ st.error("something bad happend to the model")
37
+ st.error(e)
38
+
39
  except:
40
+ st.error("Your question doesn't have the required format. Please, correct it.")
41
+ st.error(e)
42
+
mi_clase.py CHANGED
@@ -129,8 +129,8 @@ class Pipeline:
129
  #---- retriever + generator
130
 
131
  def give_the_best_answer(self,dict_with_all_the_info):
132
- a = self.get_context_from_text(my_dict["prompt"])
133
- b = self.create_tokens(my_dict,a)
134
  c = self.infer_answer(b)
135
  d = self.convert_to_letter(int(c[0][0]))
136
  #print("\nThe answer is ",)
 
129
  #---- retriever + generator
130
 
131
  def give_the_best_answer(self,dict_with_all_the_info):
132
+ a = self.get_context_from_text(dict_with_all_the_info["prompt"])
133
+ b = self.create_tokens(dict_with_all_the_info,a)
134
  c = self.infer_answer(b)
135
  d = self.convert_to_letter(int(c[0][0]))
136
  #print("\nThe answer is ",)