Update src/webui.py
Browse files- src/webui.py +7 -13
src/webui.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
"""
|
2 |
-
|
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="
|
124 |
value="sk-xxxxx"
|
125 |
)
|
126 |
base_url_gr = gr.Textbox(
|
127 |
label="π Enter your Base-URL",
|
128 |
-
placeholder="
|
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="
|
149 |
-
instruction_gr = gr.Textbox(label="πΉοΈ Instruction", lines=3, placeholder="
|
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:
|
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()
|
|
|
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()
|