Spaces:
Sleeping
Sleeping
research14
commited on
Commit
•
e7e5931
1
Parent(s):
1ca4779
testing optional gpt3 on POS/Chunk tab
Browse files
app.py
CHANGED
@@ -242,7 +242,9 @@ def interface():
|
|
242 |
|
243 |
# Inputs
|
244 |
task_prompt = gr.Textbox(show_label=False, placeholder="Write a prompt and press enter")
|
245 |
-
|
|
|
|
|
246 |
task = gr.Dropdown(["POS Tagging", "Chunking"], label="Task")
|
247 |
task_linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"], label="Linguistic Entity For Strategy 1")
|
248 |
task_btn = gr.Button(value="Submit")
|
@@ -272,7 +274,12 @@ def interface():
|
|
272 |
vicuna_S3_chatbot, llama_S3_chatbot, gpt_S3_chatbot])
|
273 |
|
274 |
# Event Handler for API Key
|
275 |
-
|
|
|
|
|
|
|
|
|
|
|
276 |
|
277 |
# vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_history):
|
278 |
# Event Handlers for Vicuna Chatbot POS/Chunk
|
@@ -294,12 +301,15 @@ def interface():
|
|
294 |
# Event Handler for GPT 3.5 Chatbot POS/Chunk, user must submit api key before submitting the prompt
|
295 |
# Will activate after getting API key
|
296 |
# task_apikey_btn.click(update_api_key, inputs=ling_ents_apikey_input)
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
303 |
|
304 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
305 |
gr.Markdown("""
|
|
|
242 |
|
243 |
# Inputs
|
244 |
task_prompt = gr.Textbox(show_label=False, placeholder="Write a prompt and press enter")
|
245 |
+
with gr.Row():
|
246 |
+
have_key = gr.Dropdown(["Yes", "No"], label="Do you own an API Key?", scale=1)
|
247 |
+
task_apikey_input = gr.Textbox(label="Open AI Key", placeholder="Enter your OpenAI key here", type="password", visible=False)
|
248 |
task = gr.Dropdown(["POS Tagging", "Chunking"], label="Task")
|
249 |
task_linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"], label="Linguistic Entity For Strategy 1")
|
250 |
task_btn = gr.Button(value="Submit")
|
|
|
274 |
vicuna_S3_chatbot, llama_S3_chatbot, gpt_S3_chatbot])
|
275 |
|
276 |
# Event Handler for API Key
|
277 |
+
def toggle_api_key_input(value):
|
278 |
+
if (value == "Yes"):
|
279 |
+
task_apikey_input.visible
|
280 |
+
|
281 |
+
have_key.elem.oninput(toggle_api_key_input)
|
282 |
+
task_apikey_input.elem.oninput(update_api_key, inputs=task_apikey_input)
|
283 |
|
284 |
# vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_history):
|
285 |
# Event Handlers for Vicuna Chatbot POS/Chunk
|
|
|
301 |
# Event Handler for GPT 3.5 Chatbot POS/Chunk, user must submit api key before submitting the prompt
|
302 |
# Will activate after getting API key
|
303 |
# task_apikey_btn.click(update_api_key, inputs=ling_ents_apikey_input)
|
304 |
+
if (have_key == "Yes"):
|
305 |
+
task_btn.click(gpt_strategies_respond, inputs=[strategy1, task, task_linguistic_entities, gpt_S1_chatbot],
|
306 |
+
outputs=[task, task_prompt, gpt_S1_chatbot])
|
307 |
+
task_btn.click(gpt_strategies_respond, inputs=[strategy1, task, task_linguistic_entities, gpt_S2_chatbot],
|
308 |
+
outputs=[task, task_prompt, gpt_S2_chatbot])
|
309 |
+
task_btn.click(gpt_strategies_respond, inputs=[strategy1, task, task_linguistic_entities, gpt_S3_chatbot],
|
310 |
+
outputs=[task, task_prompt, gpt_S3_chatbot])
|
311 |
+
|
312 |
+
|
313 |
|
314 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
315 |
gr.Markdown("""
|