netease-youdao / EmotiVoice

EmotiVoice 😊: a Multi-Voice and Prompt-Controlled TTS Engine
Apache License 2.0
6.63k stars 555 forks source link

请问如何调用本地部署起来的api? #107

Open lkyuier opened 5 months ago

lkyuier commented 5 months ago

我已经部署起来了,能访问了,如图 image 但是,当我去curlcurl -X GET "http://192.168.1.228:8501/v1/docs" -H "Content-Type: application/json" -H "Accept: application/json" curl -X GET "http://192.168.1.228:8501/api/doc" -H "Content-Type: application/json" -H "Accept: application/json" curl -X GET "http://192.168.1.228:8501/v1/audio/speech" -H "Content-Type: application/json" -H "Accept: application/json" 总是出错, image responsezong'shi总是403, 请问是为什么?

friendmine commented 5 months ago

给你一段参考代码, 出 403 肯定是你的访问网络有问题吧。 你去确认一下访问的整个网络链路是不是存在那里有问题,或者调试一下吧。

acinmavi commented 5 months ago

I also got the 403 error when calling locally image

acinmavi commented 5 months ago

I was able to call the api normally by installing the latest docker and using port 8000 image

xxp912 commented 2 months ago

Could you show the all Headers in the picture? @acinmavi

acinmavi commented 2 months ago

@xxp912 ,actually nothing special about the header , here is it : image

acinmavi commented 2 months ago

I could give you curl also for more clear `curl --location 'http://127.0.0.1:8000/v1/audio/speech' \ --header 'Content-Type: application/json' \ --data '{ "input" : "hah hah hah", "voice" : "8051", "prompt" : "开心", "language" : "zh_us", "speed" :1, "response_format" : "mp3", "model" : "emoti-voice"

}'`

nameisgood commented 1 month ago

If you deploy using Docker, you need to expose 8000 ports and then access them http://ip:8000/v1/audio/speech