|
@@ -1,3 +1,4 @@
|
|
|
+import os
|
|
|
import time
|
|
|
import requests
|
|
|
import json
|
|
@@ -36,11 +37,9 @@ def request_gpt(prompt):
|
|
|
|
|
|
|
|
|
|
|
|
- log_.info(f"response: {response}")
|
|
|
log_.info(f"response.text: {response.text}")
|
|
|
-
|
|
|
res_data = json.loads(response.text)
|
|
|
- result_content = res_data['choices'][0]['message']['content']
|
|
|
+ result_content = res_data['data']['choices'][0]['message']['content']
|
|
|
return result_content
|
|
|
|
|
|
|
|
@@ -69,6 +68,9 @@ def title_generate(video_id, video_path):
|
|
|
log_.info(f"debug: title_generate 4")
|
|
|
prompt = f"{config_.GPT_PROMPT['title']['prompt2']}{asr_res.strip()}"
|
|
|
gpt_res = request_gpt(prompt=prompt)
|
|
|
+
|
|
|
+ for file in [video_file_path, audio_path, dialogue_path]:
|
|
|
+ os.remove(file)
|
|
|
return gpt_res
|
|
|
|
|
|
|
|
@@ -78,10 +80,5 @@ def title_generate(video_id, video_path):
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if __name__ == '__main__':
|
|
|
title_generate(video_id='001', video_path='')
|