Commit
·
aa700ae
1
Parent(s):
583a612
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 3 |
|
| 4 |
-
tokenizer = AutoTokenizer.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
|
| 5 |
-
|
| 6 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
|
| 7 |
|
| 8 |
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 .'
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
max_length=135)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
| 3 |
|
| 4 |
+
pipe = pipeline(tokenizer = AutoTokenizer.from_pretrained("jpelhaw/t5-word-sense-disambiguation"), model = AutoModelForSeq2SeqLM.from_pretrained("jpelhaw/t5-word-sense-disambiguation")
|
|
|
|
|
|
|
| 5 |
|
| 6 |
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 .'
|
| 7 |
|
| 8 |
+
gr.Interface.from_pipeline(pipe,
|
| 9 |
+
inputs = "text",
|
| 10 |
+
outputs= gr.outputs.TextBox(),
|
| 11 |
+
title = "word sense disambiguation",
|
| 12 |
+
allow_flagging="never").launch(inbrowser=True)
|
|
|