Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import PyPDF2
|
| 2 |
from docx import Document
|
| 3 |
import os
|
|
@@ -5,17 +6,19 @@ from unittest.mock import patch
|
|
| 5 |
from TTS.api import TTS
|
| 6 |
import torch
|
| 7 |
import gradio as gr
|
| 8 |
-
|
| 9 |
-
|
| 10 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 11 |
|
| 12 |
# Function to always return 'y'
|
| 13 |
def always_yes(*args, **kwargs):
|
| 14 |
return 'y'
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
#################################
|
| 21 |
# Path to the audio file
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
import PyPDF2
|
| 3 |
from docx import Document
|
| 4 |
import os
|
|
|
|
| 6 |
from TTS.api import TTS
|
| 7 |
import torch
|
| 8 |
import gradio as gr
|
|
|
|
|
|
|
| 9 |
os.environ["COQUI_TOS_AGREED"] = "1"
|
| 10 |
|
| 11 |
# Function to always return 'y'
|
| 12 |
def always_yes(*args, **kwargs):
|
| 13 |
return 'y'
|
| 14 |
|
| 15 |
+
|
| 16 |
+
# Patch the input function to always return 'y'
|
| 17 |
+
with patch('builtins.input', always_yes):
|
| 18 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 19 |
+
tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2", progress_bar=False).to(device)
|
| 20 |
+
|
| 21 |
+
@spaces.GPU(enable_queue=True)
|
| 22 |
|
| 23 |
#################################
|
| 24 |
# Path to the audio file
|