with gr.Blocks(theme=gr.themes.Glass()) as demo: # 使用 'light' 主题作为默认值 21e7f29 youngtsai commited on Oct 29, 2023
with gr.Blocks(theme=gr.themes.Soft()) as demo: # 使用 'light' 主题作为默认值 e183764 youngtsai commited on Oct 29, 2023
with gr.Blocks(theme=gr.themes.Default()) as demo: # 使用 'light' 主题作为默认值 73315d1 youngtsai commited on Oct 29, 2023
with gr.Blocks(theme=gr.themes.Soft()) as demo: # 使用 'light' 主题作为默认值 759d6ff youngtsai commited on Oct 29, 2023
clear_button.click(lambda: [[],None,""], None, [chat_output, json_file, json_textbox], queue=False) e9a7746 youngtsai commited on Oct 29, 2023
clear_button.click(lambda: ["","path/to/empty.txt",""], None, [chat_output, json_file, json_textbox], queue=False) 15531a1 youngtsai commited on Oct 29, 2023
clear_button.click(lambda: ["","",""], None, [chat_output, json_file, json_textbox], queue=False) cc390c1 youngtsai commited on Oct 29, 2023
submit_button = gr.Button("Submit", style={"background-color": "#FFA500", "color": "white"}) 22a7db5 youngtsai commited on Oct 29, 2023
json_textbox = gr.Textbox(readonly=True, label="對話 JSON 內容", lines=10) cc31c5b youngtsai commited on Oct 29, 2023
with gr.Blocks(theme="light") as demo: # 使用 'light' 主题作为默认值 8d56c8c youngtsai commited on Oct 29, 2023
prompt = f"您將進行一場以{theme}為主題的對話。{role1} (gender: {role1_gender}) 和{role2} (gender: {role2_gender})將是參與者。請依次交談{rounds}輪。(1輪對話的定義是 {role1} 和 {role2} 各說一句話,總共 {sentenses_count} 句話。)以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role:\"{role1}\", \"gender\": {role1_gender} , content: \".....\"}}, {{role:\"{role2}\", \"gender\": {role2_gender}, content: \".....\"}}]" f4819db youngtsai commited on Oct 29, 2023
speech_config = speechsdk.SpeechConfig(subscription=AZURE_API_KEY, region=AZURE_REGION) 16e04ca youngtsai commited on Oct 28, 2023
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