is_space_imported
Browse files
app.py
CHANGED
@@ -6,8 +6,9 @@ import random
|
|
6 |
try:
|
7 |
# Only on HuggingFace
|
8 |
import spaces
|
|
|
9 |
except ImportError:
|
10 |
-
|
11 |
|
12 |
from tqdm import tqdm
|
13 |
from huggingface_hub import snapshot_download
|
@@ -150,11 +151,8 @@ def text2audio(
|
|
150 |
gr.update(visible = True, value = "Start again to get a different result. The output have been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec.")
|
151 |
]
|
152 |
|
153 |
-
|
154 |
-
# Only on HuggingFace
|
155 |
text2audio = spaces.GPU(text2audio, duration = 420)
|
156 |
-
except Error:
|
157 |
-
text2audio = text2audio
|
158 |
|
159 |
# Gradio interface
|
160 |
with gr.Blocks() as interface:
|
|
|
6 |
try:
|
7 |
# Only on HuggingFace
|
8 |
import spaces
|
9 |
+
is_space_imported = True
|
10 |
except ImportError:
|
11 |
+
is_space_imported = False
|
12 |
|
13 |
from tqdm import tqdm
|
14 |
from huggingface_hub import snapshot_download
|
|
|
151 |
gr.update(visible = True, value = "Start again to get a different result. The output have been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec.")
|
152 |
]
|
153 |
|
154 |
+
if is_space_imported:
|
|
|
155 |
text2audio = spaces.GPU(text2audio, duration = 420)
|
|
|
|
|
156 |
|
157 |
# Gradio interface
|
158 |
with gr.Blocks() as interface:
|