Spaces:
Sleeping
Sleeping
default_generate_conclusion_sentence_prompt = """
Browse files
app.py
CHANGED
@@ -192,11 +192,13 @@ def generate_conclusion_sentences(model, max_tokens, sys_content, scenario, eng_
|
|
192 |
"model": model,
|
193 |
"messages": messages,
|
194 |
"max_tokens": max_tokens,
|
|
|
195 |
}
|
196 |
|
197 |
response = OPEN_AI_CLIENT.chat.completions.create(**request_payload)
|
198 |
-
|
199 |
-
|
|
|
200 |
|
201 |
return gr_update
|
202 |
|
@@ -561,11 +563,20 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
561 |
I'm aiming to improve my writing.
|
562 |
By the topic sentence, please assist me by "Developing conclusion sentences"
|
563 |
based on keywords of points to finish a paragrpah as an example.
|
|
|
|
|
564 |
- Make sure any revised vocabulary aligns with the correctly eng_level.
|
565 |
- Guidelines for Length and Complexity:
|
566 |
-
Please keep the example concise and straightforward,
|
567 |
-
|
568 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
"""
|
570 |
user_generate_conclusion_sentence_prompt = gr.Textbox(label="Conclusion Sentence Prompt", value=default_generate_conclusion_sentence_prompt, visible=False)
|
571 |
|
@@ -585,7 +596,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
585 |
with gr.Column():
|
586 |
conclusion_sentence_input = gr.Textbox(label="寫出總結段落的結論句")
|
587 |
with gr.Column():
|
588 |
-
generate_conclusion_sentence_button = gr.Button("讓 JUTOR 產生例句,幫助你撰寫結論句。")
|
589 |
conclusion_sentence_output = gr.Radio(choices=[], label="AI Generated Conclusion Sentence 結論句")
|
590 |
|
591 |
conclusion_sentence_output.select(
|
@@ -622,7 +633,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue=gr.themes.colors.blue, secondary
|
|
622 |
- 最後,段落應該有一個結論句,總結主要觀點,強化所要傳遞的資訊。
|
623 |
""")
|
624 |
with gr.Row():
|
625 |
-
generate_paragraph_button = gr.Button("Generate Paragraph")
|
626 |
with gr.Row():
|
627 |
paragraph_output = gr.Textbox(label="Generated Paragraph 完整段落", show_copy_button=True)
|
628 |
|
|
|
192 |
"model": model,
|
193 |
"messages": messages,
|
194 |
"max_tokens": max_tokens,
|
195 |
+
"response_format": { "type": "json_object" }
|
196 |
}
|
197 |
|
198 |
response = OPEN_AI_CLIENT.chat.completions.create(**request_payload)
|
199 |
+
response_content = json.loads(response.choices[0].message.content)
|
200 |
+
json_content = response_content["results"]
|
201 |
+
gr_update = gr.update(choices=[json_content])
|
202 |
|
203 |
return gr_update
|
204 |
|
|
|
563 |
I'm aiming to improve my writing.
|
564 |
By the topic sentence, please assist me by "Developing conclusion sentences"
|
565 |
based on keywords of points to finish a paragrpah as an example.
|
566 |
+
|
567 |
+
Rules:
|
568 |
- Make sure any revised vocabulary aligns with the correctly eng_level.
|
569 |
- Guidelines for Length and Complexity:
|
570 |
+
- Please keep the example concise and straightforward,
|
571 |
+
- Total word-count is around 20.
|
572 |
+
|
573 |
+
Restrictions:
|
574 |
+
- avoiding overly technical language.
|
575 |
+
- no more explanation either no more extra non-relation sentences. this is very important.
|
576 |
+
|
577 |
+
Output use JSON format
|
578 |
+
EXAMPLE:
|
579 |
+
{{"results": "Thus, drinking water every day keeps us healthy and strong."}}
|
580 |
"""
|
581 |
user_generate_conclusion_sentence_prompt = gr.Textbox(label="Conclusion Sentence Prompt", value=default_generate_conclusion_sentence_prompt, visible=False)
|
582 |
|
|
|
596 |
with gr.Column():
|
597 |
conclusion_sentence_input = gr.Textbox(label="寫出總結段落的結論句")
|
598 |
with gr.Column():
|
599 |
+
generate_conclusion_sentence_button = gr.Button("讓 JUTOR 產生例句,幫助你撰寫結論句。", variant="primary")
|
600 |
conclusion_sentence_output = gr.Radio(choices=[], label="AI Generated Conclusion Sentence 結論句")
|
601 |
|
602 |
conclusion_sentence_output.select(
|
|
|
633 |
- 最後,段落應該有一個結論句,總結主要觀點,強化所要傳遞的資訊。
|
634 |
""")
|
635 |
with gr.Row():
|
636 |
+
generate_paragraph_button = gr.Button("Generate Paragraph", variant="primary")
|
637 |
with gr.Row():
|
638 |
paragraph_output = gr.Textbox(label="Generated Paragraph 完整段落", show_copy_button=True)
|
639 |
|