| """ | |
| from transformers import pipeline | |
| x = st.slider('Select a value') | |
| st.write(x, 'squared is', x * x) | |
| question_answerer = pipeline("question-answering") | |
| context = r" Extractive Question Answering is the task of extracting an answer from a text given a question. | |
| An example of a question answering dataset is the SQuAD dataset, which is entirely based on that task. | |
| If you would like to fine-tune a model on a SQuAD task, you may leverage the | |
| examples/pytorch/question-answering/run_squad.py script." | |
| question = "What is extractive question answering?" #"What is a good example of a question answering dataset?" | |
| result = question_answerer(question=question, context=context) | |
| answer = result['answer'] | |
| score = round(result['score'], 4) | |
| span = f"start: {result['start']}, end: {result['end']}" | |
| st.write(answer) | |
| st.write(f"score: {score}") | |
| st.write(f"span: {span}") | |
| """ |