|
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline |
|
|
|
|
|
model = AutoModelForQuestionAnswering.from_pretrained("spyrosbriakos/greek_legal_bert_v2") |
|
tokenizer = AutoTokenizer.from_pretrained("spyrosbriakos/greek_legal_bert_v2") |
|
|
|
|
|
qa_pipeline = pipeline("question-answering", model=model, tokenizer=tokenizer) |
|
|
|
|
|
st.title("Question Answering in Greek") |
|
|
|
|
|
context = st.text_area("Context", "Provide the context here...") |
|
question = st.text_input("Question", "Ask your question here...") |
|
|
|
|
|
if st.button("Get Answer"): |
|
if context and question: |
|
result = qa_pipeline(question=question, context=context) |
|
st.write(f"Answer: {result['answer']}") |
|
else: |
|
st.write("Please provide both context and a question.") |