Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -1,20 +1,7 @@
|
|
1 |
-
import
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
// Specify question and context
|
10 |
-
let question = 'Who was Jim Henson?'
|
11 |
-
let context = 'Jim Henson was a nice puppet.'
|
12 |
-
|
13 |
-
// Run pipeline
|
14 |
-
let answerer = await pipeline('question-answering', model);
|
15 |
-
let outputs = await answerer(question, context);
|
16 |
-
console.log(outputs);
|
17 |
-
// {
|
18 |
-
// "answer": "a nice puppet",
|
19 |
-
// "score": 0.5768911502526741
|
20 |
-
// }
|
|
|
1 |
+
from transformers import pipeline
|
2 |
|
3 |
+
qa_model = pipeline("question-answering")
|
4 |
+
question = "Where do I live?"
|
5 |
+
context = "My name is Merve and I live in İstanbul."
|
6 |
+
x = qa_model(question = question, context = context)
|
7 |
+
console.log('qa_model',x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|