paragon-analytics commited on
Commit
f4295c7
1 Parent(s): 6616eb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -35,21 +35,21 @@ max_words = 2000
35
  max_len = 111
36
 
37
  # load the model from disk
38
- filename = 'resil_lstm_model.sav'
39
- lmodel = pickle.load(open(filename, 'rb'))
40
 
41
  # load the model from disk
42
- filename = 'tokenizer.pickle'
43
- tok = pickle.load(open(filename, 'rb'))
44
 
45
  def process_final_text(text):
46
  X_test = str(text).lower()
47
- l = []
48
- l.append(X_test)
49
- test_sequences = tok.texts_to_sequences(l)
50
- test_sequences_matrix = sequence.pad_sequences(test_sequences,maxlen=max_len)
51
- lstm_prob = lmodel.predict(test_sequences_matrix.tolist()).flatten()
52
- lstm_pred = np.where(lstm_prob>=0.5,1,0)
53
 
54
  encoded_input = tokenizer(X_test, return_tensors='pt')
55
  output = model(**encoded_input)
@@ -101,7 +101,7 @@ with gr.Blocks(title=title) as demo:
101
  gr.Markdown(description1)
102
  gr.Markdown("""---""")
103
  prob1 = gr.Textbox(label="Enter Your Text Here:",lines=2, placeholder="Type it here ...")
104
- submit_btn = gr.Button("Create & Analyze")
105
  #text = gr.Textbox(label="Text:",lines=2, placeholder="Please enter text here ...")
106
  #submit_btn2 = gr.Button("Analyze")
107
 
 
35
  max_len = 111
36
 
37
  # load the model from disk
38
+ #filename = 'resil_lstm_model.sav'
39
+ #lmodel = pickle.load(open(filename, 'rb'))
40
 
41
  # load the model from disk
42
+ #filename = 'tokenizer.pickle'
43
+ #tok = pickle.load(open(filename, 'rb'))
44
 
45
  def process_final_text(text):
46
  X_test = str(text).lower()
47
+ #l = []
48
+ #l.append(X_test)
49
+ #test_sequences = tok.texts_to_sequences(l)
50
+ #test_sequences_matrix = sequence.pad_sequences(test_sequences,maxlen=max_len)
51
+ #lstm_prob = lmodel.predict(test_sequences_matrix.tolist()).flatten()
52
+ #lstm_pred = np.where(lstm_prob>=0.5,1,0)
53
 
54
  encoded_input = tokenizer(X_test, return_tensors='pt')
55
  output = model(**encoded_input)
 
101
  gr.Markdown(description1)
102
  gr.Markdown("""---""")
103
  prob1 = gr.Textbox(label="Enter Your Text Here:",lines=2, placeholder="Type it here ...")
104
+ submit_btn = gr.Button("Analyze")
105
  #text = gr.Textbox(label="Text:",lines=2, placeholder="Please enter text here ...")
106
  #submit_btn2 = gr.Button("Analyze")
107