Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,17 @@ from huggingface_hub import from_pretrained_keras
|
|
| 14 |
|
| 15 |
model = from_pretrained_keras("keras-io/text-generation-miniature-gpt")
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def text_process_pipeline(text): #pipeline
|
| 18 |
tokenizer = Tokenizer(num_words=80, split=' ')
|
| 19 |
tokenizer.fit_on_texts(word_to_index.values())
|
|
|
|
| 14 |
|
| 15 |
model = from_pretrained_keras("keras-io/text-generation-miniature-gpt")
|
| 16 |
|
| 17 |
+
a = []
|
| 18 |
+
word_to_index = {}
|
| 19 |
+
|
| 20 |
+
a_file = open("aclImdb/imdb.vocab")
|
| 21 |
+
for line in a_file:
|
| 22 |
+
a.append(line.strip())
|
| 23 |
+
print(len(a))
|
| 24 |
+
|
| 25 |
+
for index, word in enumerate(a):
|
| 26 |
+
word_to_index[index] = word
|
| 27 |
+
|
| 28 |
def text_process_pipeline(text): #pipeline
|
| 29 |
tokenizer = Tokenizer(num_words=80, split=' ')
|
| 30 |
tokenizer.fit_on_texts(word_to_index.values())
|