Mudassir-75 commited on
Commit
9a27c21
·
verified ·
1 Parent(s): 38b00d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -14,6 +14,9 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
14
  def text_to_speech(urdu_text):
15
  inputs = tokenizer(urdu_text, return_tensors="pt")
16
 
 
 
 
17
  with torch.no_grad():
18
  output = model(**inputs).waveform.numpy()
19
 
@@ -30,7 +33,7 @@ iface = gr.Interface(
30
  outputs=gr.Audio(label="Generated Speech"),
31
  title="Urdu Text-to-Speech (MMS-TTS)",
32
  description="یہ ایپلیکیشن آپ کے اردو متن کو مصنوعی آواز میں تبدیل کرتی ہے۔",
33
- theme="compact"
34
  )
35
 
36
  # Launch the app
 
14
  def text_to_speech(urdu_text):
15
  inputs = tokenizer(urdu_text, return_tensors="pt")
16
 
17
+ # Ensure input_ids are LongTensor (Fix for error)
18
+ inputs["input_ids"] = inputs["input_ids"].to(torch.long)
19
+
20
  with torch.no_grad():
21
  output = model(**inputs).waveform.numpy()
22
 
 
33
  outputs=gr.Audio(label="Generated Speech"),
34
  title="Urdu Text-to-Speech (MMS-TTS)",
35
  description="یہ ایپلیکیشن آپ کے اردو متن کو مصنوعی آواز میں تبدیل کرتی ہے۔",
36
+ theme="default"
37
  )
38
 
39
  # Launch the app