Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,12 +66,16 @@ def load_models():
|
|
| 66 |
model="Helsinki-NLP/opus-mt-tc-big-en-pt",
|
| 67 |
device=device
|
| 68 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
models['text_generation'] = pipeline(
|
| 71 |
"text-generation",
|
| 72 |
-
model=
|
| 73 |
-
|
| 74 |
-
|
| 75 |
)
|
| 76 |
|
| 77 |
models['ner'] = pipeline(
|
|
|
|
| 66 |
model="Helsinki-NLP/opus-mt-tc-big-en-pt",
|
| 67 |
device=device
|
| 68 |
)
|
| 69 |
+
|
| 70 |
+
tokenizer_gpt2 = AutoTokenizer.from_pretrained("gpt2")
|
| 71 |
+
model_gpt2 = AutoModelForCasualLM.from_pretrained("gpt2")
|
| 72 |
+
model_gpt2.config.pad_token_id = model_gpt2.config.eos_token_id
|
| 73 |
|
| 74 |
models['text_generation'] = pipeline(
|
| 75 |
"text-generation",
|
| 76 |
+
model=model_gpt2,
|
| 77 |
+
tokenizer=tokenizer_gpt2,
|
| 78 |
+
device=device
|
| 79 |
)
|
| 80 |
|
| 81 |
models['ner'] = pipeline(
|