Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
-
# Load
|
5 |
-
|
|
|
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,
|
17 |
title="تصحيح النص العربي",
|
18 |
description="أداة لتصحيح النصوص العربية باستخدام نموذج SuperSl6/Arabic-Text-Correction."
|
19 |
)
|
20 |
|
21 |
-
|
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)
|
|