thak123 commited on
Commit
3c6e00e
1 Parent(s): edae577

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -9,6 +9,11 @@ import config
9
  from transformers import pipeline, AutoTokenizer, AutoModel
10
  import gradio as gr
11
 
 
 
 
 
 
12
 
13
  # T = tokenizer.TweetTokenizer(
14
  # preserve_handles=True, preserve_hashes=True, preserve_case=False, preserve_url=False)
@@ -50,13 +55,6 @@ def sentence_prediction(sentence):
50
  num_workers=-1
51
  )
52
 
53
- device = config.device
54
-
55
- model = BERTBaseUncased()
56
- model.load_state_dict(torch.load(
57
- model_path, map_location=torch.device(device)))
58
- model.to(device)
59
-
60
  outputs, [] = engine.predict_fn(test_data_loader, model, device)
61
 
62
  outputs = classifier(sentence)
 
9
  from transformers import pipeline, AutoTokenizer, AutoModel
10
  import gradio as gr
11
 
12
+ device = config.device
13
+ model = BERTBaseUncased()
14
+ model.load_state_dict(torch.load(
15
+ model_path, map_location=torch.device(device)))
16
+ model.to(device)
17
 
18
  # T = tokenizer.TweetTokenizer(
19
  # preserve_handles=True, preserve_hashes=True, preserve_case=False, preserve_url=False)
 
55
  num_workers=-1
56
  )
57
 
 
 
 
 
 
 
 
58
  outputs, [] = engine.predict_fn(test_data_loader, model, device)
59
 
60
  outputs = classifier(sentence)