Spaces:
Runtime error
Runtime error
Commit
•
85a2ca4
1
Parent(s):
51a12d3
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,31 @@
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
1 |
import streamlit as st
|
2 |
+
#from transformers import pipeline
|
3 |
+
|
4 |
+
#pipe = pipeline('sentiment-analysis')
|
5 |
+
#text = st.text_area('enter some text!')
|
6 |
+
|
7 |
+
#if text:
|
8 |
+
# out = pipe(text)
|
9 |
+
#st.json(out)
|
10 |
+
|
11 |
from transformers import pipeline
|
12 |
|
13 |
+
model_name = "xlm-roberta-base-squad2"
|
14 |
+
|
15 |
+
qa_pl = pipeline('question-answering', model=model_name, tokenizer=model_name, device=0)
|
16 |
+
|
17 |
+
#predictions = []
|
18 |
+
|
19 |
+
# batches might be faster
|
20 |
+
context = st.text_area('Gib context')
|
21 |
+
question = st.text_area('Gib question')
|
22 |
+
|
23 |
+
if context and question:
|
24 |
+
result = qa_pl(context=ctx, question=q)
|
25 |
+
st.json(result)
|
26 |
+
|
27 |
+
#for ctx, q in test_df[["context", "question"]].to_numpy():
|
28 |
|
29 |
+
# result = qa_pl(context=ctx, question=q)
|
30 |
+
|
31 |
+
# predictions.append(result["answer"])
|