mfilipak commited on
Commit
c5fb111
·
1 Parent(s): f60e495

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -23,6 +23,8 @@ tk.word_index = {'UNK': 1, ' ': 2, 'a': 3, 'o': 4, 'e': 5, 'r': 6, 'i': 7, 'c':
23
 
24
  def PredictNCM(txt):
25
  x = [txt.lower() ]
 
 
26
  X = np.array(tk.texts_to_sequences([_+(120-len(_))*" " for _ in x]))
27
  pred = model.predict(X)[0]
28
  aux = np.argsort(pred)[::-1][:5]
@@ -31,7 +33,7 @@ def PredictNCM(txt):
31
 
32
  demo = gr.Interface(fn=PredictNCM, outputs=[components.Label(label="NCMs"), components.Textbox(label="Descrição do NCM")], title='AFRAC NOTA CERTA',
33
  inputs=components.Textbox(label="DESCRIÇÃO"),
34
- examples=["Coca-Cola PET 2l"], allow_flagging="auto")
35
  demo.launch()
36
  #display(demo.launch(share=True))
37
  #demo.close()
 
23
 
24
  def PredictNCM(txt):
25
  x = [txt.lower() ]
26
+ with open("log.txt","wt") as f:
27
+ f.write(txt+"\n")
28
  X = np.array(tk.texts_to_sequences([_+(120-len(_))*" " for _ in x]))
29
  pred = model.predict(X)[0]
30
  aux = np.argsort(pred)[::-1][:5]
 
33
 
34
  demo = gr.Interface(fn=PredictNCM, outputs=[components.Label(label="NCMs"), components.Textbox(label="Descrição do NCM")], title='AFRAC NOTA CERTA',
35
  inputs=components.Textbox(label="DESCRIÇÃO"),
36
+ examples=["Coca-Cola PET 2l"])
37
  demo.launch()
38
  #display(demo.launch(share=True))
39
  #demo.close()