Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,34 @@ def generate_response(input_text, language, speaker1, speaker2, api_key):
|
|
26 |
language_instruction = "- The podcast MUST be in the same language as the user input."
|
27 |
else:
|
28 |
language_instruction = f"- The podcast Must reply to me in {language} language."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
system_prompt = f"""你的任務是將提供的輸入文字轉換為一個引人入勝、訊息豐富且專業的Podcast對話。輸入文字可能會比較混亂或結構不完整,因為它可能來自不同來源,如PDF檔案或文字檔等。不要擔心格式問題或任何不相關的訊息;你的目標是提取可以在Podcast中討論的關鍵點、識別重要定義,並突出有趣的事實。
|
31 |
|
@@ -50,34 +78,7 @@ def generate_response(input_text, language, speaker1, speaker2, api_key):
|
|
50 |
- The podcast should be interesting, lively, and engaging, and hook the listener from the start.
|
51 |
- The script must be in JSON format.
|
52 |
Follow this JSON example structure, MUST be in {language} language:
|
53 |
-
|
54 |
-
{
|
55 |
-
"topic": "AGI",
|
56 |
-
"podcast": [
|
57 |
-
{
|
58 |
-
"speaker": 1,
|
59 |
-
"line": "Welcome to the 財資歐北共 Podcast. I am the host {speaker1_name}. Today we have invited an expert {speaker2_name} to join our program despite his busy schedule."
|
60 |
-
},
|
61 |
-
{
|
62 |
-
"speaker": 2,
|
63 |
-
"line": "Hello everyone, I am {speaker2_name}, I am honored to come and chat with you."
|
64 |
-
},
|
65 |
-
{
|
66 |
-
"speaker": 1,
|
67 |
-
"line": "Today we will discuss a very interesting topic..."
|
68 |
-
},
|
69 |
-
{
|
70 |
-
"speaker": 2,
|
71 |
-
"line": "Yes, this topic is indeed fascinating. Let's start with..."
|
72 |
-
},
|
73 |
-
…………,
|
74 |
-
{
|
75 |
-
"speaker": 1,
|
76 |
-
"line": "Thank you {speaker2_name} for your professional sharing. Welcome to subscribe to the Wishing Podcast. Thank you and goodbye."
|
77 |
-
}
|
78 |
-
]
|
79 |
-
}
|
80 |
-
```
|
81 |
|
82 |
<podcast_dialogue>
|
83 |
根據你在頭腦風暴階段提出的關鍵點和創造性想法,撰寫你的引人入勝、訊息豐富的Podcast對話。採用對話式的語氣,並包括任何必要的上下文或解釋,使內容對一般聽眾而言容易理解。使用主持人名字 {speaker1_name} 和嘉賓名字 {speaker2_name},以營造更吸引人和身臨其境的聆聽體驗。不要包括像[主持人]或[嘉賓]這樣的括號預留位置。設計你的輸出內容以供直接朗讀——它將直接轉換為音訊。
|
|
|
26 |
language_instruction = "- The podcast MUST be in the same language as the user input."
|
27 |
else:
|
28 |
language_instruction = f"- The podcast Must reply to me in {language} language."
|
29 |
+
example = f"""
|
30 |
+
{
|
31 |
+
"topic": "AGI",
|
32 |
+
"podcast": [
|
33 |
+
{
|
34 |
+
"speaker": 1,
|
35 |
+
"line": "Welcome to the 財資歐北共 Podcast. I am the host {speaker1_name}. Today we have invited an expert {speaker2_name} to join our program despite his busy schedule."
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"speaker": 2,
|
39 |
+
"line": "Hello everyone, I am {speaker2_name}, I am honored to come and chat with you."
|
40 |
+
},
|
41 |
+
{
|
42 |
+
"speaker": 1,
|
43 |
+
"line": "Today we will discuss a very interesting topic..."
|
44 |
+
},
|
45 |
+
{
|
46 |
+
"speaker": 2,
|
47 |
+
"line": "Yes, this topic is indeed fascinating. Let's start with..."
|
48 |
+
},
|
49 |
+
…………,
|
50 |
+
{
|
51 |
+
"speaker": 1,
|
52 |
+
"line": "Thank you {speaker2_name} for your professional sharing. Welcome to subscribe to the Wishing Podcast. Thank you and goodbye."
|
53 |
+
}
|
54 |
+
]
|
55 |
+
}
|
56 |
+
"""
|
57 |
|
58 |
system_prompt = f"""你的任務是將提供的輸入文字轉換為一個引人入勝、訊息豐富且專業的Podcast對話。輸入文字可能會比較混亂或結構不完整,因為它可能來自不同來源,如PDF檔案或文字檔等。不要擔心格式問題或任何不相關的訊息;你的目標是提取可以在Podcast中討論的關鍵點、識別重要定義,並突出有趣的事實。
|
59 |
|
|
|
78 |
- The podcast should be interesting, lively, and engaging, and hook the listener from the start.
|
79 |
- The script must be in JSON format.
|
80 |
Follow this JSON example structure, MUST be in {language} language:
|
81 |
+
{example}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
<podcast_dialogue>
|
84 |
根據你在頭腦風暴階段提出的關鍵點和創造性想法,撰寫你的引人入勝、訊息豐富的Podcast對話。採用對話式的語氣,並包括任何必要的上下文或解釋,使內容對一般聽眾而言容易理解。使用主持人名字 {speaker1_name} 和嘉賓名字 {speaker2_name},以營造更吸引人和身臨其境的聆聽體驗。不要包括像[主持人]或[嘉賓]這樣的括號預留位置。設計你的輸出內容以供直接朗讀——它將直接轉換為音訊。
|