Update app.py
Browse files
app.py
CHANGED
|
@@ -5,10 +5,15 @@ from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
|
| 5 |
import requests
|
| 6 |
import json
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
class SecondLifeNavigator:
|
| 9 |
-
def __init__(self,
|
| 10 |
-
|
| 11 |
-
self.
|
|
|
|
| 12 |
self.corrade_api_key = corrade_api_key
|
| 13 |
|
| 14 |
def send_command_to_corrade(self, corrade_endpoint, command, parameters):
|
|
|
|
| 5 |
import requests
|
| 6 |
import json
|
| 7 |
|
| 8 |
+
# Global initialization
|
| 9 |
+
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 10 |
+
model = GPT2LMHeadModel.from_pretrained('gpt2')
|
| 11 |
+
|
| 12 |
class SecondLifeNavigator:
|
| 13 |
+
def __init__(self, corrade_api_key='nucleus'):
|
| 14 |
+
global tokenizer, model
|
| 15 |
+
self.tokenizer = tokenizer
|
| 16 |
+
self.model = model
|
| 17 |
self.corrade_api_key = corrade_api_key
|
| 18 |
|
| 19 |
def send_command_to_corrade(self, corrade_endpoint, command, parameters):
|