Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,14 @@ def guessanAge(model, image):
|
|
| 21 |
description = imgclassifier(image)
|
| 22 |
return description
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier")
|
| 26 |
tab1 = gr.Interface(
|
|
@@ -36,5 +44,12 @@ tab2 = gr.Interface(
|
|
| 36 |
outputs=["text"],
|
| 37 |
)
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
demo.launch()
|
|
|
|
| 21 |
description = imgclassifier(image)
|
| 22 |
return description
|
| 23 |
|
| 24 |
+
def text2speech(model, text):
|
| 25 |
+
st.write("using model:"+model)
|
| 26 |
+
if len(text) > 0:
|
| 27 |
+
speechclassifier = pipeline("text-to-speech", model=model)
|
| 28 |
+
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
| 29 |
+
speaker_embedding = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0)
|
| 30 |
+
output = speechclassifier(text, forward_params={"speaker_embeddings": speaker_embedding})
|
| 31 |
+
return output
|
| 32 |
|
| 33 |
radio1 = gr.Radio(["microsoft/resnet-50", "google/vit-base-patch16-224", "apple/mobilevit-small"], label="Select a Classifier", info="Image Classifier")
|
| 34 |
tab1 = gr.Interface(
|
|
|
|
| 44 |
outputs=["text"],
|
| 45 |
)
|
| 46 |
|
| 47 |
+
radio3 = gr.Radio(["microsoft/speecht5_tts"], label="Select an tts", info="Age Classifier")
|
| 48 |
+
tab3 = gr.Interface(
|
| 49 |
+
fn=text2speech,
|
| 50 |
+
inputs=[radio3, "text"],
|
| 51 |
+
outputs=["audio"],
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
demo = gr.TabbedInterface([tab1, tab2, tab3], ["tab1", "tab2", "tab3"])
|
| 55 |
demo.launch()
|