MarioMamdouh121 commited on
Commit
9c8d6cc
·
verified ·
1 Parent(s): e0793b2

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +6 -6
src/streamlit_app.py CHANGED
@@ -1,14 +1,14 @@
1
  from transformers import AutoModelForQuestionAnswering, AutoTokenizer
2
- from arabert.preprocess import ArabertPreprocessor
3
  import streamlit as st
4
  import torch
5
  import os
6
 
7
  # Load model
8
- model = AutoModelForQuestionAnswering.from_pretrained("MarioMamdouh121/arabic-qa-model")
9
- tokenizer = AutoTokenizer.from_pretrained("MarioMamdouh121/arabic-qa-model")
10
 
11
- arabert_prep = ArabertPreprocessor(model_name="aubmindlab/bert-base-arabertv2")
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 = arabert_prep.preprocess(context)
23
- question_proc = arabert_prep.preprocess(question)
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(