alifatmi commited on
Commit
4fa4779
1 Parent(s): 80eccb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
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 = torch.device("cuda")
87
  generated = generated.to(device)
88
- device = torch.device("cuda")
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: