audio_path = dialogue_to_audio(structured_dialogue, role1_gender, role2_gender) 89c580c youngtsai commited on Oct 28, 2023
def dialogue_to_audio(dialogue, role1_gender, role2_gender): a2e3e4d youngtsai commited on Oct 28, 2023
def main_function(password: str, theme: str, language: str, method: str, rounds: int, role1: str, role1_gender: str, role2: str, role2_gender: str): 71cee5c youngtsai commited on Oct 28, 2023
def main_function(password: str, theme: str, language: str, method: str, rounds: int, role1_data: tuple, role2_data: tuple): 6ac85f0 youngtsai commited on Oct 28, 2023
text = " ".join([f"{item['content']}" for item in dialogue]) cb575a5 youngtsai commited on Oct 28, 2023
dialogue = create_chat_dialogue(rounds, role1, role2, theme, language) 46d0709 youngtsai commited on Oct 28, 2023
def create_chat_dialogue(rounds, role1, role2, theme, language): a48f81b youngtsai commited on Oct 28, 2023
prompt = f"您將進行一場以{theme}為主題的對話。{role1}和{role2}將是參與者。請依次交談{rounds}輪。(1輪對話的定義是 {role1} 和 {role2} 各說一句話。)以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role:\"{role1}\", content: \".....\"}}, {{role:\"{role2}\", content: \".....\"}}]" e3ecbca youngtsai commited on Oct 28, 2023
sys_content = f"你是一個英文家教,請用英文生成對話,請嚴格控制 {rounds} 輪對話的長度。 1輪對話的定義是 {role1} 和 {role2} 各說一句話。" fc2ceb8 youngtsai commited on Oct 28, 2023
prompt = f"您將進行一場以{theme}為主題的對話。{role1}和{role2}將是參與者。請依次交談{rounds}輪。以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role:\"{role1}\", content: \".....\"}}, {{role:\"{role2}\", content: \".....\"}}]" 1e259ff youngtsai commited on Oct 28, 2023
dialogue = validate_and_correct_chat(data=extract_json, roles=[role1, role2], rounds=rounds) c17ed50 youngtsai commited on Oct 28, 2023
dialogue = validate_and_correct_chat(extract_json, roles=[role1, role2], rounds) 3f9e47f youngtsai commited on Oct 28, 2023
prompt = f"您將進行一場以{theme}為主題的對話。{role1}和{role2}將是參與者。請依次交談{rounds}輪。以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role1:\"{role1}\", content: \".....\"}}, {{role2:\"{role2}\", content: \".....\"}}]" 500d500 youngtsai commited on Oct 28, 2023
def generate_dialogue(rounds, method, role1, role2, theme): 318fe60 youngtsai commited on Oct 28, 2023
def generate_dialogue(rounds=2, method="auto", role1="Mary", role2="Ken", theme="購物"): af62096 youngtsai commited on Oct 28, 2023
def main_function(password: str, theme: str, method: str, rounds: int, role1: str, role2: str): 06479e1 youngtsai commited on Oct 28, 2023
gr.components.Textbox(label="對話主題", default="購物"), # 加入 theme 的輸入框,設定預設值為 '購物' 25e4cb4 youngtsai commited on Oct 28, 2023
def main_function(password: str, rounds: int, method: str, role1: str, role2: str): 1e07170 youngtsai commited on Oct 28, 2023
chatbot_dialogue = [(item["role"], item["content"]) for item in structured_dialogue] 3cf8ded youngtsai commited on Oct 28, 2023