Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,11 @@ def create_client(api_key=None):
|
|
15 |
def generate_response(input_text, language, speaker1, speaker2, api_key):
|
16 |
speaker1_name = speaker1.split(' - ')[0]
|
17 |
speaker2_name = speaker2.split(' - ')[0]
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
system_prompt = f"""你的任務是將提供的輸入文字轉換為一個引人入勝、訊息豐富且專業的Podcast對話。輸入文字可能會比較混亂或結構不完整,因為它可能來自不同來源,如PDF檔案或文字檔等。不要擔心格式問題或任何不相關的訊息;你的目標是提取可以在Podcast中討論的關鍵點、識別重要定義,並突出有趣的事實。
|
20 |
|
21 |
以下是你將要處理的輸入文字:
|
@@ -35,7 +39,8 @@ def generate_response(input_text, language, speaker1, speaker2, api_key):
|
|
35 |
將你的頭腦風暴想法和Podcast對話的粗略大綱寫在這裡。確保記錄下你希望在結尾重申的主要見解和要點。
|
36 |
</scratchpad>
|
37 |
|
38 |
-
|
|
|
39 |
- The podcast should have 2 speakers: {speaker1_name} and {speaker2_name}.
|
40 |
- The podcast should be long.
|
41 |
- The podcast should be interesting, lively, and engaging, and hook the listener from the start.
|
@@ -53,7 +58,7 @@ Follow this example structure:
|
|
53 |
```
|
54 |
|
55 |
<podcast_dialogue>
|
56 |
-
|
57 |
|
58 |
確保對話儘可能詳細、完整,同時保持在主題之內並維持吸引人的流暢性。目標是使用你的全部輸出容量,建立儘可能長的Podcast節目,同時以有趣的方式傳遞輸入文字中的關鍵訊息。
|
59 |
|
|
|
15 |
def generate_response(input_text, language, speaker1, speaker2, api_key):
|
16 |
speaker1_name = speaker1.split(' - ')[0]
|
17 |
speaker2_name = speaker2.split(' - ')[0]
|
18 |
+
if language == "Auto Detect":
|
19 |
+
language_instruction = "- The podcast MUST be in the same language as the user input."
|
20 |
+
else:
|
21 |
+
language_instruction = f"- The podcast MUST be in {language} language"
|
22 |
+
|
23 |
system_prompt = f"""你的任務是將提供的輸入文字轉換為一個引人入勝、訊息豐富且專業的Podcast對話。輸入文字可能會比較混亂或結構不完整,因為它可能來自不同來源,如PDF檔案或文字檔等。不要擔心格式問題或任何不相關的訊息;你的目標是提取可以在Podcast中討論的關鍵點、識別重要定義,並突出有趣的事實。
|
24 |
|
25 |
以下是你將要處理的輸入文字:
|
|
|
39 |
將你的頭腦風暴想法和Podcast對話的粗略大綱寫在這裡。確保記錄下你希望在結尾重申的主要見解和要點。
|
40 |
</scratchpad>
|
41 |
|
42 |
+
現在你已經進行了頭腦風暴並建立了一個粗略的大綱,是時候撰寫實際的Podcast對話了。目標是主持人({speaker1_name})與嘉賓({speaker2_name})之間自然、對話式的交流。融入你在頭腦風暴中得出的最佳想法,並確保將任何複雜話題以易於理解的方式解釋清楚。
|
43 |
+
{language_instruction}
|
44 |
- The podcast should have 2 speakers: {speaker1_name} and {speaker2_name}.
|
45 |
- The podcast should be long.
|
46 |
- The podcast should be interesting, lively, and engaging, and hook the listener from the start.
|
|
|
58 |
```
|
59 |
|
60 |
<podcast_dialogue>
|
61 |
+
根據你在頭腦風暴階段提出的關鍵點和創造性想法,撰寫你的引人入勝、訊息豐富的Podcast對話。採用對話式的語氣,並包括任何必要的上下文或解釋,使內容對一般聽眾而言容易理解。使用主持人名字 {speaker1_name} 和嘉賓名字 {speaker2_name},以營造更吸引人和身臨其境的聆聽體驗。不要包括像[主持人]或[嘉賓]這樣的括號預留位置。設計你的輸出內容以供直接朗讀——它將直接轉換為音訊。
|
62 |
|
63 |
確保對話儘可能詳細、完整,同時保持在主題之內並維持吸引人的流暢性。目標是使用你的全部輸出容量,建立儘可能長的Podcast節目,同時以有趣的方式傳遞輸入文字中的關鍵訊息。
|
64 |
|