ShawnRu commited on
Commit
64fd7bf
Β·
verified Β·
1 Parent(s): 283ac11

Update src/webui.py

Browse files
Files changed (1) hide show
  1. src/webui.py +7 -13
src/webui.py CHANGED
@@ -1,8 +1,7 @@
1
  """
2
- ....../OneKE$ python src/webui.py
3
  """
4
 
5
-
6
  import gradio as gr
7
  import json
8
  import random
@@ -113,19 +112,14 @@ def create_interface():
113
  ],
114
  value="deepseek-chat",
115
  )
116
- # model_gr = gr.Textbox(
117
- # label="πŸͺ„ Enter your Model",
118
- # placeholder="Supports online-models like gpt-4o-mini, deepseek-chat, etc., HuggingFace Demo is not supported for local models.",
119
- # value="deepseek-chat",
120
- # )
121
  api_key_gr = gr.Textbox(
122
  label="πŸ”‘ Enter your API-Key",
123
- placeholder="We currently support the API-Key from ChatGPT or DeepSeek.",
124
  value="sk-xxxxx"
125
  )
126
  base_url_gr = gr.Textbox(
127
  label="πŸ”— Enter your Base-URL",
128
- placeholder="If using the default Base-URL, this field should be left empty.",
129
  value="Default",
130
  )
131
  with gr.Column():
@@ -145,8 +139,8 @@ def create_interface():
145
 
146
  use_file_gr = gr.Checkbox(label="πŸ“‚ Use File", value=True)
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)
@@ -179,7 +173,7 @@ def create_interface():
179
  def update_fields(task):
180
  if task == "Base" or task == "":
181
  return gr.update(visible=True, label="πŸ•ΉοΈ Instruction", lines=3,
182
- placeholder="Please 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.")
@@ -405,4 +399,4 @@ def create_interface():
405
  # Launch the front-end interface
406
  if __name__ == "__main__":
407
  interface = create_interface()
408
- interface.launch() # the Gradio defalut URL usually is: 127.0.0.1:7860
 
1
  """
2
+ For HuggingFace Space.
3
  """
4
 
 
5
  import gradio as gr
6
  import json
7
  import random
 
112
  ],
113
  value="deepseek-chat",
114
  )
 
 
 
 
 
115
  api_key_gr = gr.Textbox(
116
  label="πŸ”‘ Enter your API-Key",
117
+ placeholder="Please enter your API-Key from ChatGPT or DeepSeek.",
118
  value="sk-xxxxx"
119
  )
120
  base_url_gr = gr.Textbox(
121
  label="πŸ”— Enter your Base-URL",
122
+ placeholder="Please leave this field empty if using the default Base-URL.",
123
  value="Default",
124
  )
125
  with gr.Column():
 
139
 
140
  use_file_gr = gr.Checkbox(label="πŸ“‚ Use File", value=True)
141
  file_path_gr = gr.File(label="πŸ“– Upload a File", visible=True)
142
+ text_gr = gr.Textbox(label="πŸ“– Text", lines=5, placeholder="Please enter the text to be processed.", visible=False)
143
+ instruction_gr = gr.Textbox(label="πŸ•ΉοΈ Instruction", lines=3, placeholder="Please enter any type of information you want to extract here, for example: Help me extract all the place names.", visible=True)
144
  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)
145
 
146
  update_case_gr = gr.Checkbox(label="πŸ’° Update Case", value=False)
 
173
  def update_fields(task):
174
  if task == "Base" or task == "":
175
  return gr.update(visible=True, label="πŸ•ΉοΈ Instruction", lines=3,
176
+ placeholder="Please enter any type of information you want to extract here, for example: Help me extract all the place names."), gr.update(visible=False)
177
  elif task == "NER":
178
  return gr.update(visible=False), gr.update(visible=True, label="πŸ•ΉοΈ Constraint", lines=3,
179
  placeholder="Please specify the entity types to extract in list format, and all types will be extracted by default if not specified.")
 
399
  # Launch the front-end interface
400
  if __name__ == "__main__":
401
  interface = create_interface()
402
+ interface.launch()