AbstractPhil commited on
Commit
323ce30
·
verified ·
1 Parent(s): c71cf49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -1,6 +1,6 @@
1
  # app.py
2
 
3
- from transformers import AutoTokenizer, AutoModelForMaskedLM
4
  import torch
5
  import gradio as gr
6
  import re
@@ -50,15 +50,10 @@ symbolic_roles = [
50
  "<fabric>", "<jewelry>"
51
  ]
52
 
53
- REPO_ID = "AbstractPhil/bert-beatrix-2048"
54
- REVISION = "main"
55
- tokenizer = AutoTokenizer.from_pretrained(REPO_ID, revision=REVISION)
56
- model = AutoModelForMaskedLM.from_pretrained(
57
- REPO_ID,
58
- revision=REVISION,
59
- trust_remote_code=True,
60
- ignore_mismatched_sizes=True
61
- ).eval().cuda()
62
 
63
  def build_interface():
64
  with gr.Blocks() as demo:
 
1
  # app.py
2
 
3
+ from bert_handler import create_handler_from_checkpoint
4
  import torch
5
  import gradio as gr
6
  import re
 
50
  "<fabric>", "<jewelry>"
51
  ]
52
 
53
+ # Load from official hosted checkpoint
54
+ checkpoint_path = "./bert-beatrix-2048"
55
+ handler, model, tokenizer = create_handler_from_checkpoint(checkpoint_path)
56
+ model = model.eval().cuda()
 
 
 
 
 
57
 
58
  def build_interface():
59
  with gr.Blocks() as demo: