Jaehan commited on
Commit
fdc396d
·
1 Parent(s): 98cf63a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -6,10 +6,11 @@ text2text_tokenizer = AutoTokenizer.from_pretrained(model_name)
6
  model = AutoModelWithLMHead.from_pretrained(model_name)
7
 
8
  def text2text(context, answer):
9
- input_text = f"answer: {answer} context: {context}"
10
  features = text2text_tokenizer([input_text], return_tensors="pt")
11
  output = model.generate(input_ids=features["input_ids"], attention_mask=features["attention_mask"], max_length=100)
12
  response = text2text_tokenizer.decode(output[0])
 
13
 
14
  context = gr.Textbox(lines=10, label="English", placeholder="Context")
15
  answer = gr.Textbox(lines=1, label="Answer")
 
6
  model = AutoModelWithLMHead.from_pretrained(model_name)
7
 
8
  def text2text(context, answer):
9
+ input_text = f"answer: {answer} context: <{context}>"
10
  features = text2text_tokenizer([input_text], return_tensors="pt")
11
  output = model.generate(input_ids=features["input_ids"], attention_mask=features["attention_mask"], max_length=100)
12
  response = text2text_tokenizer.decode(output[0])
13
+ return response
14
 
15
  context = gr.Textbox(lines=10, label="English", placeholder="Context")
16
  answer = gr.Textbox(lines=1, label="Answer")