Shruhrid Banthia commited on
Commit
48034d5
1 Parent(s): fdedfc2

made code flexible regardless of input

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -10,13 +10,14 @@ with open('without_laplace.sav','rb') as handle:
10
  loaded_model = pickle.load(handle)
11
  def fn(X_test):
12
 
13
-
14
- X_final = tuple(map(str, X_test.split(' ')))
 
15
  model = loaded_model
16
  result = model._best_candidate(X_final,0)
17
 
18
  return result
19
- description = "Give two words as input and our model will predict the next word"
20
  here = gr.Interface(fn=fn,
21
  inputs= gradio.inputs.Textbox( lines=1, placeholder=None, default="", label=None),
22
  outputs='text',
 
10
  loaded_model = pickle.load(handle)
11
  def fn(X_test):
12
 
13
+
14
+ X_final_list = list(map(str, X_test.split(' ')))
15
+ X_final=tuple(X_final_list[-2:])
16
  model = loaded_model
17
  result = model._best_candidate(X_final,0)
18
 
19
  return result
20
+ description = "Here is an interface for next word prediction using tri-gram model. Given an input, our model will predict the next word. Please make sure not to add a space after the last word."
21
  here = gr.Interface(fn=fn,
22
  inputs= gradio.inputs.Textbox( lines=1, placeholder=None, default="", label=None),
23
  outputs='text',