Mert commited on
Commit
05e47c6
·
1 Parent(s): fdc21ba

Add application file

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("question-answering", model="incidelen/bert-base-turkish-cased-qa")
5
+
6
+ st.title("Turkish Question-Answering 🇹🇷")
7
+ st.markdown("""
8
+ **This application is designed to find answers to questions based on Turkish texts.**
9
+ Please enter the context and type your question, then click 'Get Answer' to find the answer.
10
+ """)
11
+
12
+ st.markdown("---")
13
+
14
+ context = st.text_area("Context:", height=200, placeholder="Paste your text here...")
15
+ question = st.text_input("Question:", placeholder="Type your question here...")
16
+
17
+ st.markdown("## 🔍 Find the Answer")
18
+ st.write("")
19
+
20
+ if st.button("Get Answer"):
21
+ if context and question:
22
+ result = pipe(question=question, context=context)
23
+ answer = result['answer']
24
+ st.markdown(f"### **Answer:**")
25
+ st.success(answer)
26
+ else:
27
+ st.warning("Please fill in both the context and question fields.")
28
+
29
+ st.markdown("---")
30
+ st.markdown("This application uses the [`incidelen/bert-base-turkish-cased-qa`](https://huggingface.co/incidelen/bert-base-turkish-cased-qa) question-answering model.")
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ streamlit
2
+ torch
3
+ transformers