SuperSl6 commited on
Commit
227b2b4
·
verified ·
1 Parent(s): 071167e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,8 +1,9 @@
1
- from transformers import pipeline
2
  import gradio as gr
3
 
4
- # Load the model using pipeline
5
- model = pipeline("text2text-generation", model="SuperSl6/Arabic-Text-Correction")
 
6
 
7
  def correct_text(input_text):
8
  result = model(input_text)[0]['generated_text']
@@ -13,10 +14,9 @@ interface = gr.Interface(
13
  fn=correct_text,
14
  inputs=gr.Textbox(lines=3, placeholder="أدخل النص العربي هنا..."),
15
  outputs=gr.Textbox(),
16
- live=True, # Real-time processing
17
  title="تصحيح النص العربي",
18
  description="أداة لتصحيح النصوص العربية باستخدام نموذج SuperSl6/Arabic-Text-Correction."
19
  )
20
 
21
- # Launch the app
22
- interface.launch(debug=True)
 
1
+ from transformers import pipeline, AutoTokenizer
2
  import gradio as gr
3
 
4
+ # Load tokenizer with use_fast=False
5
+ tokenizer = AutoTokenizer.from_pretrained("SuperSl6/Arabic-Text-Correction", use_fast=False)
6
+ model = pipeline("text2text-generation", model="SuperSl6/Arabic-Text-Correction", tokenizer=tokenizer)
7
 
8
  def correct_text(input_text):
9
  result = model(input_text)[0]['generated_text']
 
14
  fn=correct_text,
15
  inputs=gr.Textbox(lines=3, placeholder="أدخل النص العربي هنا..."),
16
  outputs=gr.Textbox(),
17
+ live=True,
18
  title="تصحيح النص العربي",
19
  description="أداة لتصحيح النصوص العربية باستخدام نموذج SuperSl6/Arabic-Text-Correction."
20
  )
21
 
22
+ interface.launch(debug=True)