Update app.py
Browse files
app.py
CHANGED
@@ -83,13 +83,10 @@ input_text = st.text_input("Please Provide your text:")
|
|
83 |
title = input_text
|
84 |
prompt = SPECIAL_TOKENS['bos_token'] + title + SPECIAL_TOKENS['sep_token']
|
85 |
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
86 |
-
device =
|
87 |
generated = generated.to(device)
|
88 |
-
|
89 |
-
model.cuda()
|
90 |
model.eval();
|
91 |
-
from heapq import nsmallest
|
92 |
-
|
93 |
# Generate text
|
94 |
|
95 |
if len(input_text)>0:
|
|
|
83 |
title = input_text
|
84 |
prompt = SPECIAL_TOKENS['bos_token'] + title + SPECIAL_TOKENS['sep_token']
|
85 |
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
86 |
+
device =torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
87 |
generated = generated.to(device)
|
88 |
+
model.to(device)
|
|
|
89 |
model.eval();
|
|
|
|
|
90 |
# Generate text
|
91 |
|
92 |
if len(input_text)>0:
|