deekshachilukuri commited on
Commit
11f1864
·
verified ·
1 Parent(s): 1b52ad3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -8,18 +8,23 @@ import torch
8
  import gradio as gr
9
  from torchaudio import load
10
 
 
11
  os.environ["COQUI_TOS_AGREED"] = "1"
12
 
 
13
  # Function to always return 'y'
14
  def always_yes(*args, **kwargs):
15
  return 'y'
16
 
17
-
18
  # Patch the input function to always return 'y'
19
  with patch('builtins.input', always_yes):
20
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
21
  tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2", progress_bar=False).to(device)
22
 
 
 
 
 
23
  #sa = 'sampleaudio.wav'
24
 
25
 
@@ -38,6 +43,8 @@ def text_to_speech(text):
38
  return save_path
39
  except Exception as e:
40
  return str(e)
 
 
41
 
42
  def extract_text_from_pdf(file_path):
43
  with open(file_path, 'rb') as file:
@@ -69,4 +76,7 @@ def handle_inputs(text, file):
69
  audio_path = file_to_audio(file)
70
  return audio_path, 'Thanks for your File'
71
  else:
72
- return None, "No input provided."
 
 
 
 
8
  import gradio as gr
9
  from torchaudio import load
10
 
11
+ print("completed imported packages")
12
  os.environ["COQUI_TOS_AGREED"] = "1"
13
 
14
+
15
  # Function to always return 'y'
16
  def always_yes(*args, **kwargs):
17
  return 'y'
18
 
 
19
  # Patch the input function to always return 'y'
20
  with patch('builtins.input', always_yes):
21
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
22
  tts = TTS(model_name="tts_models/multilingual/multi-dataset/xtts_v2", progress_bar=False).to(device)
23
 
24
+
25
+ @spaces.GPU(enable_queue=True)
26
+
27
+ print("loded the model")
28
  #sa = 'sampleaudio.wav'
29
 
30
 
 
43
  return save_path
44
  except Exception as e:
45
  return str(e)
46
+
47
+ print("first function")
48
 
49
  def extract_text_from_pdf(file_path):
50
  with open(file_path, 'rb') as file:
 
76
  audio_path = file_to_audio(file)
77
  return audio_path, 'Thanks for your File'
78
  else:
79
+ return None, "No input provided."
80
+
81
+
82
+ print("last function")