Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# app.py
|
| 2 |
|
| 3 |
-
from
|
| 4 |
import torch
|
| 5 |
import gradio as gr
|
| 6 |
import re
|
|
@@ -50,15 +50,10 @@ symbolic_roles = [
|
|
| 50 |
"<fabric>", "<jewelry>"
|
| 51 |
]
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
tokenizer =
|
| 56 |
-
model =
|
| 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:
|