|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
pipe = pipeline("question-answering", model="incidelen/bert-base-turkish-cased-qa") |
|
|
|
st.title("Turkish Question-Answering 🇹🇷") |
|
st.markdown(""" |
|
**This application is designed to find answers to questions based on Turkish texts.** |
|
Please enter the context and type your question, then click 'Get Answer' to find the answer. |
|
""") |
|
|
|
st.markdown("---") |
|
|
|
context = st.text_area("Context:", height=200, placeholder="Paste your text here...") |
|
question = st.text_input("Question:", placeholder="Type your question here...") |
|
|
|
st.markdown("## 🔍 Find the Answer") |
|
st.write("") |
|
|
|
if st.button("Get Answer"): |
|
if context and question: |
|
result = pipe(question=question, context=context) |
|
answer = result['answer'] |
|
st.markdown(f"### **Answer:**") |
|
st.success(answer) |
|
else: |
|
st.warning("Please fill in both the context and question fields.") |
|
|
|
st.markdown("---") |
|
st.markdown("This application uses the [`incidelen/bert-base-turkish-cased-qa`](https://huggingface.co/incidelen/bert-base-turkish-cased-qa) question-answering model.") |