Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,8 @@ model1.load_state_dict(torch.load("gpt_model.pth", map_location=torch.device('cp
|
|
| 8 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 9 |
model1 = model1.to(device)
|
| 10 |
# Character mappings from the training script
|
|
|
|
|
|
|
| 11 |
chars = sorted(list(set(text)))
|
| 12 |
vocab_size = len(chars)
|
| 13 |
stoi = { ch:i for i,ch in enumerate(chars) }
|
|
|
|
| 8 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 9 |
model1 = model1.to(device)
|
| 10 |
# Character mappings from the training script
|
| 11 |
+
with open('input.txt', 'r', encoding='utf-8') as f:
|
| 12 |
+
text = f.read()
|
| 13 |
chars = sorted(list(set(text)))
|
| 14 |
vocab_size = len(chars)
|
| 15 |
stoi = { ch:i for i,ch in enumerate(chars) }
|