Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -40,6 +40,11 @@ examples = [
|
|
40 |
["王大明意圖為自己不法所有,基於竊盜之犯意,"]
|
41 |
]
|
42 |
|
|
|
|
|
|
|
|
|
|
|
43 |
with gr.Blocks() as demo:
|
44 |
gr.Markdown(
|
45 |
"""
|
@@ -47,14 +52,14 @@ with gr.Blocks() as demo:
|
|
47 |
""")
|
48 |
with gr.Row():
|
49 |
with gr.Column():
|
50 |
-
result = gr.components.Textbox(lines=7, label="Writing Assist", placeholder=
|
51 |
prompt = gr.components.Textbox(lines=2, label="Prompt", placeholder=examples[0], visible=False)
|
52 |
gr.Examples(examples, label='Examples', inputs=[prompt])
|
53 |
prompt.change(generate, inputs=[prompt], outputs=[result])
|
54 |
btn = gr.Button("Next sentence")
|
55 |
btn.click(generate, inputs=[result], outputs=[result])
|
56 |
with gr.Column():
|
57 |
-
result2 = gr.components.Textbox(lines=7, label="Random Generative", show_label=True, placeholder=
|
58 |
gr.Examples(examples, label='Examples', inputs=[result2])
|
59 |
btn = gr.Button("Random Drafting")
|
60 |
btn.click(rnd_generate, inputs=[result2], outputs=[result2])
|
|
|
40 |
["王大明意圖為自己不法所有,基於竊盜之犯意,"]
|
41 |
]
|
42 |
|
43 |
+
prompts = [
|
44 |
+
["輸入寫書類的句子,讓電腦生成下一句。或是按以下的範例句子。"],
|
45 |
+
["輸入寫書類的開頭句子,讓電腦隨機生成整篇草稿。"]
|
46 |
+
]
|
47 |
+
|
48 |
with gr.Blocks() as demo:
|
49 |
gr.Markdown(
|
50 |
"""
|
|
|
52 |
""")
|
53 |
with gr.Row():
|
54 |
with gr.Column():
|
55 |
+
result = gr.components.Textbox(lines=7, label="Writing Assist", placeholder=prompts[0])
|
56 |
prompt = gr.components.Textbox(lines=2, label="Prompt", placeholder=examples[0], visible=False)
|
57 |
gr.Examples(examples, label='Examples', inputs=[prompt])
|
58 |
prompt.change(generate, inputs=[prompt], outputs=[result])
|
59 |
btn = gr.Button("Next sentence")
|
60 |
btn.click(generate, inputs=[result], outputs=[result])
|
61 |
with gr.Column():
|
62 |
+
result2 = gr.components.Textbox(lines=7, label="Random Generative", show_label=True, placeholder=prompts[1])
|
63 |
gr.Examples(examples, label='Examples', inputs=[result2])
|
64 |
btn = gr.Button("Random Drafting")
|
65 |
btn.click(rnd_generate, inputs=[result2], outputs=[result2])
|