Spaces:
Sleeping
Sleeping
def generate_paragraph(topic_sentence, supporting_sentences, conclusion_sentence):
Browse files
app.py
CHANGED
@@ -168,7 +168,14 @@ def generate_conclusion_sentences(model, max_tokens, sys_content, scenario, eng_
|
|
168 |
content = response.choices[0].message.content.strip()
|
169 |
|
170 |
return content
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
with gr.Blocks() as demo:
|
173 |
with gr.Row():
|
174 |
with gr.Column():
|
@@ -249,13 +256,17 @@ with gr.Blocks() as demo:
|
|
249 |
user_generate_conclusion_sentence_prompt = gr.Textbox(label="Conclusion Sentence Prompt", value=default_generate_conclusion_sentence_prompt)
|
250 |
generate_conclusion_sentence_button = gr.Button("Generate Conclusion Sentence")
|
251 |
|
|
|
|
|
|
|
|
|
252 |
|
253 |
with gr.Column():
|
254 |
topic_output = gr.Textbox(label="Generated Topic 主題")
|
255 |
points_output = gr.Textbox(label="Generated Points 要點")
|
256 |
topic_sentence_output = gr.Textbox(label="Generated Topic Sentences 主題句")
|
257 |
supporting_sentences_output = gr.Textbox(label="Generated Supporting Sentences 支持句")
|
258 |
-
|
259 |
|
260 |
generate_topics_button.click(
|
261 |
fn=generate_topics,
|
@@ -331,4 +342,14 @@ with gr.Blocks() as demo:
|
|
331 |
outputs=supporting_sentences_output
|
332 |
)
|
333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
demo.launch()
|
|
|
168 |
content = response.choices[0].message.content.strip()
|
169 |
|
170 |
return content
|
171 |
+
|
172 |
+
def generate_paragraph(topic_sentence, supporting_sentences, conclusion_sentence):
|
173 |
+
"""
|
174 |
+
根据用户输入的主题句、支持句、结论句,生成完整的段落。
|
175 |
+
"""
|
176 |
+
paragraph = f"{topic_sentence}\n{supporting_sentences}\n{conclusion_sentence}"
|
177 |
+
return paragraph
|
178 |
+
|
179 |
with gr.Blocks() as demo:
|
180 |
with gr.Row():
|
181 |
with gr.Column():
|
|
|
256 |
user_generate_conclusion_sentence_prompt = gr.Textbox(label="Conclusion Sentence Prompt", value=default_generate_conclusion_sentence_prompt)
|
257 |
generate_conclusion_sentence_button = gr.Button("Generate Conclusion Sentence")
|
258 |
|
259 |
+
gr.Markdown("## 7. Paragraph Integration and Revision")
|
260 |
+
conclusion_sentence_input = gr.Textbox(label="Conclusion Sentence")
|
261 |
+
generate_paragraph_button = gr.Button("Generate Paragraph")
|
262 |
+
|
263 |
|
264 |
with gr.Column():
|
265 |
topic_output = gr.Textbox(label="Generated Topic 主題")
|
266 |
points_output = gr.Textbox(label="Generated Points 要點")
|
267 |
topic_sentence_output = gr.Textbox(label="Generated Topic Sentences 主題句")
|
268 |
supporting_sentences_output = gr.Textbox(label="Generated Supporting Sentences 支持句")
|
269 |
+
paragraph_output = gr.Textbox(label="Generated Paragraph 完整段落")
|
270 |
|
271 |
generate_topics_button.click(
|
272 |
fn=generate_topics,
|
|
|
342 |
outputs=supporting_sentences_output
|
343 |
)
|
344 |
|
345 |
+
generate_paragraph_button.click(
|
346 |
+
fn=generate_paragraph,
|
347 |
+
inputs=[
|
348 |
+
topic_sentence_input,
|
349 |
+
supporting_sentences_input,
|
350 |
+
conclusion_sentence_input
|
351 |
+
],
|
352 |
+
outputs=paragraph_output
|
353 |
+
)
|
354 |
+
|
355 |
demo.launch()
|