moThecarpenter80 commited on
Commit
429ace2
1 Parent(s): 1adc6b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,9 +1,12 @@
1
  import streamlit as st
2
  from transformers import MarianTokenizer, MarianMTModel , BertTokenizer, AutoModelForSeq2SeqLM, pipeline
3
- from ar_correct import ar_correct
 
4
  import mishkal.tashkeel
 
5
  from arabert.preprocess import ArabertPreprocessor
6
 
 
7
  # Initialize Mishkal vocalizer
8
  vocalizer = mishkal.tashkeel.TashkeelClass()
9
 
@@ -19,7 +22,7 @@ tokenizer_summarization = BertTokenizer.from_pretrained(model_name)
19
  model_summarization = AutoModelForSeq2SeqLM.from_pretrained(model_name)
20
  pipeline_summarization = pipeline("text2text-generation", model=model_summarization, tokenizer=tokenizer_summarization)
21
 
22
-
23
  def main():
24
  st.title("U3reb Demo")
25
 
@@ -42,7 +45,7 @@ def main():
42
  # Arabic Text Correction
43
  st.subheader("Arabic Text Correction (ar_correct)")
44
  if input_text:
45
- corrected_text = ar_correct(input_text)
46
  st.write("Corrected Text:", corrected_text)
47
 
48
  # Text Summarization
 
1
  import streamlit as st
2
  from transformers import MarianTokenizer, MarianMTModel , BertTokenizer, AutoModelForSeq2SeqLM, pipeline
3
+ from ar_corrector.corrector import Corrector
4
+
5
  import mishkal.tashkeel
6
+
7
  from arabert.preprocess import ArabertPreprocessor
8
 
9
+
10
  # Initialize Mishkal vocalizer
11
  vocalizer = mishkal.tashkeel.TashkeelClass()
12
 
 
22
  model_summarization = AutoModelForSeq2SeqLM.from_pretrained(model_name)
23
  pipeline_summarization = pipeline("text2text-generation", model=model_summarization, tokenizer=tokenizer_summarization)
24
 
25
+ corr = Corrector()
26
  def main():
27
  st.title("U3reb Demo")
28
 
 
45
  # Arabic Text Correction
46
  st.subheader("Arabic Text Correction (ar_correct)")
47
  if input_text:
48
+ corrected_text = corr.contextual_correct(input_text)
49
  st.write("Corrected Text:", corrected_text)
50
 
51
  # Text Summarization