minjibi commited on
Commit
68e81e9
·
1 Parent(s): 63dd6a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -16,6 +16,7 @@ tokenizer = MT5TokenizerFast.from_pretrained(
16
  )
17
 
18
  def predict(text):
 
19
  # with torch.no_grad():
20
  input_ids = tokenizer.encode(text, return_tensors="pt", add_special_tokens=True)
21
  generated_ids = model.generate(
@@ -41,7 +42,7 @@ def predict(text):
41
 
42
  output = ['Q: ' + text for text in preds]
43
  final_str = '\n'.join([f"{i+1}. Question: {s.split('Answer')[0].strip()}\n Answer{s.split('Answer')[1].strip()}" for i, s in enumerate(output)])
44
- return final_str
45
 
46
  # text_to_predict = predict(text)
47
  # predicted = ['Q: ' + text for text in predict(text_to_predict)]
 
16
  )
17
 
18
  def predict(text):
19
+
20
  # with torch.no_grad():
21
  input_ids = tokenizer.encode(text, return_tensors="pt", add_special_tokens=True)
22
  generated_ids = model.generate(
 
42
 
43
  output = ['Q: ' + text for text in preds]
44
  final_str = '\n'.join([f"{i+1}. Question: {s.split('Answer')[0].strip()}\n Answer{s.split('Answer')[1].strip()}" for i, s in enumerate(output)])
45
+ return final_str
46
 
47
  # text_to_predict = predict(text)
48
  # predicted = ['Q: ' + text for text in predict(text_to_predict)]