MohamedRashad commited on
Commit
bd630a2
1 Parent(s): c536008

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import tempfile
2
 
3
  import edge_tts
4
  import gradio as gr
5
- from transformers import pipeline
6
  import pyarabic.araby as araby
7
 
8
  language_dict = {
@@ -442,13 +442,16 @@ language_dict = {
442
  }
443
  }
444
 
445
- pipe = pipeline("text2text-generation", model="mush42/fine-tashkeel")
446
 
447
  async def text_to_speech_edge(text, language_code, speaker, tashkeel_checkbox=False):
448
 
449
  # Remove diacritics from Arabic text then add tashkeel
450
  if language_code == "Arabic" and tashkeel_checkbox:
451
- text = pipe(araby.strip_diacritics(text))[0]["generated_text"].strip()
 
 
 
452
 
453
  # Get the voice for the selected language and speaker
454
  voice = language_dict[language_code][speaker]
 
2
 
3
  import edge_tts
4
  import gradio as gr
5
+ from gradio_client import Client
6
  import pyarabic.araby as araby
7
 
8
  language_dict = {
 
442
  }
443
  }
444
 
445
+ client = Client("MohamedRashad/arabic-auto-tashkeel")
446
 
447
  async def text_to_speech_edge(text, language_code, speaker, tashkeel_checkbox=False):
448
 
449
  # Remove diacritics from Arabic text then add tashkeel
450
  if language_code == "Arabic" and tashkeel_checkbox:
451
+ text = client.predict(
452
+ input_text=araby.strip_diacritics(text),
453
+ api_name="/infer_shakkala"
454
+ )
455
 
456
  # Get the voice for the selected language and speaker
457
  voice = language_dict[language_code][speaker]