xl2533 commited on
Commit
4e7746a
1 Parent(s): a14848d
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -94,16 +94,17 @@ with gr.Blocks(title="Automatic Prompt Engineer", theme=gr.themes.Glass()) as de
94
  gr.Markdown('## 第一步:输入参数并上传数据')
95
  with gr.Row():
96
  with gr.Column():
97
- openai_key2 = gr.Textbox(type='password', label='输入 API key')
98
  n_human = gr.Slider(label="人工指令数", minimum=1, maximum=5, step=1, value=2)
99
  n_machine = gr.Slider(label="机器指令数", minimum=1, maximum=5, step=1, value=1)
100
  n_instruct = gr.Slider(label="生成指令数", minimum=1, maximum=100, step=1, value=4, help="生成指令数>人工+机器")
101
- seed_file = gr.File(label='上传json文件, 格式参考./self/data/seed_task.json')
102
-
103
- with gr.Column():
104
  self_prompt_input = gr.Textbox(max_lines=100, lines=20, interative=True,
105
  placeholder=self_prompt,
106
  value='', label="Prompt for self-instruct")
 
 
 
 
 
107
  self_instance = gr.State()
108
 
109
  gr.Markdown('\n\n')
@@ -151,7 +152,7 @@ with gr.Blocks(title="Automatic Prompt Engineer", theme=gr.themes.Glass()) as de
151
  SELF Callback
152
  """
153
  # 1. 加载种子文件
154
- seed_file.submit(init_instance, inputs=[seed_file, openai_key2, n_human, n_machine, n_instruct, self_prompt_input],
155
  outputs=[self_instance])
156
 
157
  # 2. 生成
 
94
  gr.Markdown('## 第一步:输入参数并上传数据')
95
  with gr.Row():
96
  with gr.Column():
 
97
  n_human = gr.Slider(label="人工指令数", minimum=1, maximum=5, step=1, value=2)
98
  n_machine = gr.Slider(label="机器指令数", minimum=1, maximum=5, step=1, value=1)
99
  n_instruct = gr.Slider(label="生成指令数", minimum=1, maximum=100, step=1, value=4, help="生成指令数>人工+机器")
 
 
 
100
  self_prompt_input = gr.Textbox(max_lines=100, lines=20, interative=True,
101
  placeholder=self_prompt,
102
  value='', label="Prompt for self-instruct")
103
+ with gr.Column():
104
+ openai_key2 = gr.Textbox(type='password', label='输入 API key')
105
+ seed_file = gr.File(label='上传json文件, 格式参考./self/data/seed_task.json')
106
+ self_submit = gr.Button('上传')
107
+
108
  self_instance = gr.State()
109
 
110
  gr.Markdown('\n\n')
 
152
  SELF Callback
153
  """
154
  # 1. 加载种子文件
155
+ self_submit.click(init_instance, inputs=[seed_file, openai_key2, n_human, n_machine, n_instruct, self_prompt_input],
156
  outputs=[self_instance])
157
 
158
  # 2. 生成