ShawnRu commited on
Commit
14c39ae
ยท
verified ยท
1 Parent(s): 434eb0f

Update src/webui.py

Browse files
Files changed (1) hide show
  1. src/webui.py +12 -8
src/webui.py CHANGED
@@ -147,7 +147,7 @@ def create_interface():
147
  file_path_gr = gr.File(label="๐Ÿ“– Upload a File", visible=True)
148
  text_gr = gr.Textbox(label="๐Ÿ“– Text", lines=5, placeholder="Enter your Text please.", visible=False)
149
  instruction_gr = gr.Textbox(label="๐Ÿ•น๏ธ Instruction", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.", visible=True)
150
- constraint_gr = gr.Textbox(label="๐Ÿ•น๏ธ Constraint", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.", visible=False)
151
 
152
  update_case_gr = gr.Checkbox(label="๐Ÿ’ฐ Update Case", value=False)
153
  # update_schema_gr = gr.Checkbox(label="๐Ÿ“Ÿ Update Schema", value=False)
@@ -178,16 +178,20 @@ def create_interface():
178
 
179
  def update_fields(task):
180
  if task == "Base" or task == "":
181
- return gr.update(visible=True, label="๐Ÿ•น๏ธ Instruction", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names."), gr.update(visible=False)
 
182
  elif task == "NER":
183
- # TODO
184
- return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.")
185
  elif task == "RE":
186
- return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.")
 
187
  elif task == "EE":
188
- return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.")
 
189
  elif task == "Triple":
190
- return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.")
 
191
 
192
  def update_input_fields(use_file):
193
  if use_file:
@@ -401,4 +405,4 @@ def create_interface():
401
  # Launch the front-end interface
402
  if __name__ == "__main__":
403
  interface = create_interface()
404
- interface.launch() # the Gradio defalut URL usually is: 127.0.0.1:7860
 
147
  file_path_gr = gr.File(label="๐Ÿ“– Upload a File", visible=True)
148
  text_gr = gr.Textbox(label="๐Ÿ“– Text", lines=5, placeholder="Enter your Text please.", visible=False)
149
  instruction_gr = gr.Textbox(label="๐Ÿ•น๏ธ Instruction", lines=3, placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names.", visible=True)
150
+ constraint_gr = gr.Textbox(label="๐Ÿ•น๏ธ Constraint", lines=3, placeholder="Please specify the types of entities, relations, events, or other relevant attributes in list format as per the task requirements.", visible=False)
151
 
152
  update_case_gr = gr.Checkbox(label="๐Ÿ’ฐ Update Case", value=False)
153
  # update_schema_gr = gr.Checkbox(label="๐Ÿ“Ÿ Update Schema", value=False)
 
178
 
179
  def update_fields(task):
180
  if task == "Base" or task == "":
181
+ return gr.update(visible=True, label="๐Ÿ•น๏ธ Instruction", lines=3,
182
+ placeholder="You can enter any type of information you want to extract here, for example: Please help me extract all the person names."), gr.update(visible=False)
183
  elif task == "NER":
184
+ return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3,
185
+ placeholder="Please specify the entity types to extract in list format, and all types will be extracted by default if not specified.")
186
  elif task == "RE":
187
+ return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3,
188
+ placeholder="Please specify the relation types to extract in list format, and all types will be extracted by default if not specified.")
189
  elif task == "EE":
190
+ return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3,
191
+ placeholder="Please specify the event types and their corresponding extraction attributes in dictionary format, and all types and attributes will be extracted by default if not specified.")
192
  elif task == "Triple":
193
+ return gr.update(visible=False), gr.update(visible=True, label="๐Ÿ•น๏ธ Constraint", lines=3,
194
+ placeholder="Please read the documentation and specify the types of triples in list format.")
195
 
196
  def update_input_fields(use_file):
197
  if use_file:
 
405
  # Launch the front-end interface
406
  if __name__ == "__main__":
407
  interface = create_interface()
408
+ interface.launch()