Belligerent's picture
Update app.py
56519a9
raw
history blame
824 Bytes
import gradio as gr
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
model = AutoModelForSeq2SeqLM.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
input = 'question: which description describes the word " java " best in the following context? descriptions:[ " A drink consisting of an infusion of ground coffee beans "," a platform-independent programming language ", or " an island in Indonesia to the south of Borneo " ] context: I like to drink " java " in the morning .'
example = tokenizer.tokenize(input, add_special_tokens=True)
answer = model.generate(input_ids=example['input_ids'],
attention_mask=example['attention_mask'],
max_length=135)