mjlee
commited on
Commit
ยท
499c31b
1
Parent(s):
3a9c126
0708_7
Browse files
app.py
CHANGED
@@ -15,12 +15,12 @@ print("downloading model...")
|
|
15 |
sen_model_file = hf_hub_download(repo_id=SENTIMENT_REPO_ID, filename=SENTIMENT_FILENAME)
|
16 |
entity_model_file = hf_hub_download(repo_id=ENTITY_REPO_ID, filename=ENTITY_FILENAME)
|
17 |
|
18 |
-
base_model =
|
19 |
|
20 |
tokenizer = AutoTokenizer.from_pretrained(base_model)
|
21 |
|
22 |
sen_model = Classifier(base_model, num_labels=2, device=device, tokenizer=tokenizer)
|
23 |
-
sen_model.load_state_dict(torch.load(sen_model_file))
|
24 |
|
25 |
entity_model = Classifier(base_model, num_labels=2, device=device, tokenizer=tokenizer)
|
26 |
entity_model.load_state_dict(torch.load(entity_model_file))
|
@@ -75,7 +75,7 @@ def infer(test_sentence):
|
|
75 |
result = '\n'.join(annotation)
|
76 |
return result
|
77 |
|
78 |
-
article = "
|
79 |
|
80 |
demo = gr.Interface(fn=infer,
|
81 |
inputs=gr.Textbox(type="text", label="Input Sentence"),
|
|
|
15 |
sen_model_file = hf_hub_download(repo_id=SENTIMENT_REPO_ID, filename=SENTIMENT_FILENAME)
|
16 |
entity_model_file = hf_hub_download(repo_id=ENTITY_REPO_ID, filename=ENTITY_FILENAME)
|
17 |
|
18 |
+
base_model = base_model
|
19 |
|
20 |
tokenizer = AutoTokenizer.from_pretrained(base_model)
|
21 |
|
22 |
sen_model = Classifier(base_model, num_labels=2, device=device, tokenizer=tokenizer)
|
23 |
+
sen_model.load_state_dict(torch.load('/resolve/main/'+sen_model_file))
|
24 |
|
25 |
entity_model = Classifier(base_model, num_labels=2, device=device, tokenizer=tokenizer)
|
26 |
entity_model.load_state_dict(torch.load(entity_model_file))
|
|
|
75 |
result = '\n'.join(annotation)
|
76 |
return result
|
77 |
|
78 |
+
article = "**๋ถ์ํ ํ
์คํธ๋ฅผ ์
๋ ฅํ์ธ์.**" \
|
79 |
|
80 |
demo = gr.Interface(fn=infer,
|
81 |
inputs=gr.Textbox(type="text", label="Input Sentence"),
|