Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
|
3 |
+
tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
|
4 |
+
model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
|
5 |
+
|
6 |
+
text = "Tell a story"
|
7 |
+
|
8 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
9 |
+
|
10 |
+
output = model(**encoded_input)
|