rogerxavier
commited on
Commit
•
7ab60ac
1
Parent(s):
4fd8044
Update 3mergeDialogToVideo.py
Browse files- 3mergeDialogToVideo.py +7 -3
3mergeDialogToVideo.py
CHANGED
@@ -21,6 +21,10 @@ import json
|
|
21 |
from io import BytesIO
|
22 |
import pandas as pd
|
23 |
from PIL import Image
|
|
|
|
|
|
|
|
|
24 |
|
25 |
|
26 |
#通过去水印完整漫画图片->获取相应的对话框图片->获取对话框文字->返回对话框文字
|
@@ -113,8 +117,8 @@ def get_sorted_dialog_text(image_path:"包含后缀的文件路径")->"返回排
|
|
113 |
#通过文字获取音频
|
114 |
def get_audio_data(text:str)-> "返回audio data io句柄, duration":
|
115 |
# Creates an instance of a speech config with specified subscription key and service region.
|
116 |
-
speech_key =
|
117 |
-
service_region =
|
118 |
|
119 |
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
|
120 |
# Note: the voice setting will not overwrite the voice element in input SSML.
|
@@ -151,7 +155,7 @@ def zero_pad(s, length):
|
|
151 |
|
152 |
def gpt_polish(text:str)->"通过gpt润色str文案并返回str新文案,或者gpt请求失败none":
|
153 |
# Set your OpenAI API key
|
154 |
-
api_key =
|
155 |
|
156 |
# Define the headers
|
157 |
headers = {
|
|
|
21 |
from io import BytesIO
|
22 |
import pandas as pd
|
23 |
from PIL import Image
|
24 |
+
import os
|
25 |
+
azure_speech_key = os.getenv['azure_speech_key']
|
26 |
+
azure_service_region = os.getenv['azure_service_region']
|
27 |
+
my_openai_key = os.getenv['my_openai_key']
|
28 |
|
29 |
|
30 |
#通过去水印完整漫画图片->获取相应的对话框图片->获取对话框文字->返回对话框文字
|
|
|
117 |
#通过文字获取音频
|
118 |
def get_audio_data(text:str)-> "返回audio data io句柄, duration":
|
119 |
# Creates an instance of a speech config with specified subscription key and service region.
|
120 |
+
speech_key = azure_speech_key
|
121 |
+
service_region = azure_service_region
|
122 |
|
123 |
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
|
124 |
# Note: the voice setting will not overwrite the voice element in input SSML.
|
|
|
155 |
|
156 |
def gpt_polish(text:str)->"通过gpt润色str文案并返回str新文案,或者gpt请求失败none":
|
157 |
# Set your OpenAI API key
|
158 |
+
api_key = my_openai_key
|
159 |
|
160 |
# Define the headers
|
161 |
headers = {
|