Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,19 +8,23 @@ from datasets import load_dataset
|
|
8 |
from diffusers import DiffusionPipeline
|
9 |
from huggingface_hub import login
|
10 |
import numpy as np
|
|
|
11 |
|
|
|
12 |
def guessanImage(model, image):
|
13 |
imgclassifier = pipeline("image-classification", model=model)
|
14 |
if image is not None:
|
15 |
description = imgclassifier(image)
|
16 |
return description
|
17 |
|
|
|
18 |
def guessanAge(model, image):
|
19 |
imgclassifier = pipeline("image-classification", model=model)
|
20 |
if image is not None:
|
21 |
description = imgclassifier(image)
|
22 |
return description
|
23 |
|
|
|
24 |
def text2speech(model, text, voice):
|
25 |
print(voice)
|
26 |
if len(text) > 0:
|
@@ -34,6 +38,7 @@ def text2speech(model, text, voice):
|
|
34 |
audio_data_16bit = (audio_data * 32767).astype(np.int16)
|
35 |
return speech["sampling_rate"], audio_data_16bit
|
36 |
|
|
|
37 |
def ImageGenFromText(text, model):
|
38 |
api_key = os.getenv("fluxauth")
|
39 |
login(token=api_key)
|
|
|
8 |
from diffusers import DiffusionPipeline
|
9 |
from huggingface_hub import login
|
10 |
import numpy as np
|
11 |
+
import spaces
|
12 |
|
13 |
+
@spaces.GPU
|
14 |
def guessanImage(model, image):
|
15 |
imgclassifier = pipeline("image-classification", model=model)
|
16 |
if image is not None:
|
17 |
description = imgclassifier(image)
|
18 |
return description
|
19 |
|
20 |
+
@spaces.GPU
|
21 |
def guessanAge(model, image):
|
22 |
imgclassifier = pipeline("image-classification", model=model)
|
23 |
if image is not None:
|
24 |
description = imgclassifier(image)
|
25 |
return description
|
26 |
|
27 |
+
@spaces.GPU
|
28 |
def text2speech(model, text, voice):
|
29 |
print(voice)
|
30 |
if len(text) > 0:
|
|
|
38 |
audio_data_16bit = (audio_data * 32767).astype(np.int16)
|
39 |
return speech["sampling_rate"], audio_data_16bit
|
40 |
|
41 |
+
@spaces.GPU
|
42 |
def ImageGenFromText(text, model):
|
43 |
api_key = os.getenv("fluxauth")
|
44 |
login(token=api_key)
|