Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,19 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
from transformers import T5Config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# 加载 Visual Question Answering 模型 microsoft/git-base-vqav2
|
| 6 |
vqa_pipeline = pipeline("text2text-generation", model="microsoft/git-base-vqav2")
|
| 7 |
|
| 8 |
-
# 加载文本到语音模型并手动指定
|
| 9 |
-
|
| 10 |
-
text_to_speech_pipeline = pipeline("text-to-speech", model="microsoft/speecht5_tts", config=config)
|
| 11 |
|
| 12 |
def main():
|
| 13 |
st.title("Visual Question Answering with Text-to-Speech")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
from transformers import T5Config
|
| 4 |
+
from datasets import load_dataset
|
| 5 |
+
|
| 6 |
+
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
| 7 |
+
|
| 8 |
+
speaker_embeddings = embeddings_dataset[7306]["xvector"]
|
| 9 |
+
speaker_embeddings = torch.tensor(speaker_embeddings).unsqueeze(0)
|
| 10 |
+
|
| 11 |
|
| 12 |
# 加载 Visual Question Answering 模型 microsoft/git-base-vqav2
|
| 13 |
vqa_pipeline = pipeline("text2text-generation", model="microsoft/git-base-vqav2")
|
| 14 |
|
| 15 |
+
# 加载文本到语音模型并手动指定
|
| 16 |
+
text_to_speech_pipeline = pipeline("text-to-speech", model="microsoft/speecht5_tts")
|
|
|
|
| 17 |
|
| 18 |
def main():
|
| 19 |
st.title("Visual Question Answering with Text-to-Speech")
|