Commit History

refactor
b7db810

youngtsai commited on

client = OpenAI(api_key=OPEN_AI_KEY)
00605bc

youngtsai commited on

cefr_level
ea01f67

youngtsai commited on

with gr.Blocks(theme=gr.themes.Soft()) as demo: # 使用 'light' 主题作为默认值
d292fe4

youngtsai commited on

with gr.Blocks(theme=gr.themes.Base()) as demo: # 使用 'light' 主题作为默认值
053e3d3

youngtsai commited on

with gr.Blocks(theme=gr.themes.Glass()) as demo: # 使用 'light' 主题作为默认值
21e7f29

youngtsai commited on

with gr.Blocks(theme=gr.themes.Soft()) as demo: # 使用 'light' 主题作为默认值
e183764

youngtsai commited on

with gr.Blocks(theme=gr.themes.Default()) as demo: # 使用 'light' 主题作为默认值
73315d1

youngtsai commited on

with gr.Blocks(theme=gr.themes.Soft()) as demo: # 使用 'light' 主题作为默认值
759d6ff

youngtsai commited on

with gr.Row(theme=gr.themes.Soft()):
cbd6f64

youngtsai commited on

clear_button.click(lambda: [[],None,""], None, [chat_output, json_file, json_textbox], queue=False)
e9a7746

youngtsai commited on

clear_button.click(lambda: ["","path/to/empty.txt",""], None, [chat_output, json_file, json_textbox], queue=False)
15531a1

youngtsai commited on

clear_button.click(lambda: ["","",""], None, [chat_output, json_file, json_textbox], queue=False)
cc390c1

youngtsai commited on

clear_button = gr.Button("Clear")
b052980

youngtsai commited on

submit_button = gr.Button("Submit", type="submit")
1858dc4

youngtsai commited on

submit_button.click(
536f8a9

youngtsai commited on

submit_button = gr.Button("Submit", style={"background-color": "#FFA500", "color": "white"})
22a7db5

youngtsai commited on

with gr.Column(scale=2): # 2/3 的宽度
0de648e

youngtsai commited on

refactor
d400299

youngtsai commited on

json_textbox = gr.Textbox(readonly=True, label="對話 JSON 內容", lines=10)
cc31c5b

youngtsai commited on

demo.launch(inline=False, share=True)
eee5af3

youngtsai commited on

with gr.Blocks(theme="light") as demo: # 使用 'light' 主题作为默认值
8d56c8c

youngtsai commited on

layout = gr.Row(
50c9cb2

youngtsai commited on

layout="1:3" # 新增這一行
833774e

youngtsai commited on

readonly=True, label="對話 JSON 內容", lines=10
3dae297

youngtsai commited on

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

delete audio
d4dc5f0

youngtsai commited on

def detect_language(text):
635f86b

youngtsai commited on

azure-cognitiveservices-speech
dc702e1

youngtsai commited on

speech_config = speechsdk.SpeechConfig(subscription=AZURE_API_KEY, region=AZURE_REGION)
16e04ca

youngtsai commited on

import pyttsx3
7fac4f2

youngtsai commited on

engine = pyttsx3.init()
8d75709

youngtsai commited on

audio_path = dialogue_to_audio(structured_dialogue, role1_gender, role2_gender)
89c580c

youngtsai commited on

def dialogue_to_audio(dialogue, role1_gender, role2_gender):
a2e3e4d

youngtsai commited on

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

def main_function(password: str, theme: str, language: str, method: str, rounds: int, role1_data: tuple, role2_data: tuple):
6ac85f0

youngtsai commited on

text = " ".join([f"{item['content']}" for item in dialogue])
cb575a5

youngtsai commited on

role1_content = f"{structured_dialogue[i]['content']}"
cb56cc7

youngtsai commited on

dialogue = create_chat_dialogue(rounds, role1, role2, theme, language)
46d0709

youngtsai commited on

def create_chat_dialogue(rounds, role1, role2, theme, language):
a48f81b

youngtsai commited on

gr.components.Dropdown(choices=["中文", "英文"], label="語言"),
acdf0a8

youngtsai commited on

import gradio as gr
1f9274c

youngtsai commited on

prompt = f"您將進行一場以{theme}為主題的對話。{role1}和{role2}將是參與者。請依次交談{rounds}輪。(1輪對話的定義是 {role1} 和 {role2} 各說一句話。)以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role:\"{role1}\", content: \".....\"}}, {{role:\"{role2}\", content: \".....\"}}]"
e3ecbca

youngtsai commited on

sys_content = f"你是一個英文家教,請用英文生成對話,請嚴格控制 {rounds} 輪對話的長度。 1輪對話的定義是 {role1} 和 {role2} 各說一句話。"
fc2ceb8

youngtsai commited on

sys_content = f"你是一個英文家教,請用英文生成對話,請嚴格控制 {rounds} 輪對話的長度。"
c62c781

youngtsai commited on

prompt = f"您將進行一場以{theme}為主題的對話。{role1}和{role2}將是參與者。請依次交談{rounds}輪。以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role:\"{role1}\", content: \".....\"}}, {{role:\"{role2}\", content: \".....\"}}]"
1e259ff

youngtsai commited on

dialogue = validate_and_correct_chat(data=extract_json, roles=[role1, role2], rounds=rounds)
c17ed50

youngtsai commited on

roles = [role1, role2]
c2cda0e

youngtsai commited on

dialogue = validate_and_correct_chat(extract_json, roles=[role1, role2], rounds)
3f9e47f

youngtsai commited on

prompt = f"您將進行一場以{theme}為主題的對話。{role1}和{role2}將是參與者。請依次交談{rounds}輪。以json格式儲存對話。並回傳對話JSON文件。格式為:[{{role1:\"{role1}\", content: \".....\"}}, {{role2:\"{role2}\", content: \".....\"}}]"
500d500

youngtsai commited on