Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +6 -6
src/streamlit_app.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer
|
| 2 |
-
from
|
| 3 |
import streamlit as st
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
|
| 7 |
# Load model
|
| 8 |
-
model = AutoModelForQuestionAnswering.from_pretrained("
|
| 9 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
# Streamlit interface
|
| 14 |
st.title("Arabic Question Answering")
|
|
@@ -19,8 +19,8 @@ question = st.text_input("السؤال")
|
|
| 19 |
|
| 20 |
if st.button("احصل على الجواب") and context and question:
|
| 21 |
# Preprocess
|
| 22 |
-
context_proc =
|
| 23 |
-
question_proc =
|
| 24 |
|
| 25 |
# Tokenize
|
| 26 |
inputs = tokenizer(
|
|
|
|
| 1 |
from transformers import AutoModelForQuestionAnswering, AutoTokenizer
|
| 2 |
+
from farasa.segmenter import FarasaSegmenter
|
| 3 |
import streamlit as st
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
|
| 7 |
# Load model
|
| 8 |
+
model = AutoModelForQuestionAnswering.from_pretrained("checkpoint-2817")
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained("checkpoint-2817")
|
| 10 |
|
| 11 |
+
segmenter = FarasaSegmenter(interactive=False)
|
| 12 |
|
| 13 |
# Streamlit interface
|
| 14 |
st.title("Arabic Question Answering")
|
|
|
|
| 19 |
|
| 20 |
if st.button("احصل على الجواب") and context and question:
|
| 21 |
# Preprocess
|
| 22 |
+
context_proc = segmenter.segment(context)
|
| 23 |
+
question_proc = segmenter.segment(question)
|
| 24 |
|
| 25 |
# Tokenize
|
| 26 |
inputs = tokenizer(
|