File size: 1,129 Bytes
05e47c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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.")