Spaces:
Sleeping
Sleeping
abdullahmeda
commited on
Commit
•
fdf2776
1
Parent(s):
d00901f
Update app.py
Browse files
app.py
CHANGED
@@ -9,14 +9,16 @@ from nltk.data import load as nltk_load
|
|
9 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
10 |
|
11 |
|
12 |
-
|
13 |
-
sent_cut_en = NLTK.tokenize
|
14 |
-
clf = joblib.load(f'data/gpt2-large-model', 'rb')
|
15 |
-
|
16 |
model_id = 'gpt2-large'
|
17 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
18 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
CROSS_ENTROPY = torch.nn.CrossEntropyLoss(reduction='none')
|
21 |
|
22 |
|
@@ -99,6 +101,7 @@ def predict(text):
|
|
99 |
return out
|
100 |
|
101 |
|
|
|
102 |
with gr.Blocks() as demo:
|
103 |
gr.Markdown(
|
104 |
"""
|
|
|
9 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
10 |
|
11 |
|
12 |
+
print("Loading model & Tokenizer...")
|
|
|
|
|
|
|
13 |
model_id = 'gpt2-large'
|
14 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
15 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
16 |
|
17 |
+
print("Loading NLTL & and scikit-learn model...")
|
18 |
+
NLTK = nltk_load('data/english.pickle')
|
19 |
+
sent_cut_en = NLTK.tokenize
|
20 |
+
clf = joblib.load(f'data/gpt2-large-model', 'rb')
|
21 |
+
|
22 |
CROSS_ENTROPY = torch.nn.CrossEntropyLoss(reduction='none')
|
23 |
|
24 |
|
|
|
101 |
return out
|
102 |
|
103 |
|
104 |
+
print("Building Gradio Interface...")
|
105 |
with gr.Blocks() as demo:
|
106 |
gr.Markdown(
|
107 |
"""
|