Spaces:
Runtime error
Runtime error
Commit
·
1223eb2
1
Parent(s):
a5ff1a8
user can type their own linguistic entity
Browse files
app.py
CHANGED
|
@@ -224,7 +224,7 @@ def interface():
|
|
| 224 |
- If you own an OpenAI API key, select 'Yes' in the dropdown. If you don't own one, select 'No'.
|
| 225 |
- If you selected 'Yes', enter your OpenAI API Key [Link to your OpenAI keys](https://platform.openai.com/api-keys).
|
| 226 |
- If you selected 'No', leave the 'OpenAI Key' field blank and continue with the rest.
|
| 227 |
-
- Select a Linguistic Entity from the Dropdown.
|
| 228 |
- Click 'Submit' to send your inputs to the models.
|
| 229 |
- To submit a new prompt, repeat all the steps above and click 'Submit' again. Your new prompt should appear on the top of previous ones.
|
| 230 |
|
|
@@ -242,9 +242,7 @@ def interface():
|
|
| 242 |
# Will activate after getting API key
|
| 243 |
have_key2 = gr.Dropdown(["Yes", "No"], label="Do you own an API Key?", scale=0.5)
|
| 244 |
ling_ents_apikey_input = gr.Textbox(label="Open AI Key", placeholder="Enter your Openai key here", type="password")
|
| 245 |
-
linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"
|
| 246 |
-
with gr.Accordion("If other, enter your own Linguistic Entity here:"):
|
| 247 |
-
linguistic_entities_other = gr.Textbox(show_label=False, placeholder="Enter your own Linguistic Entity")
|
| 248 |
ling_ents_btn = gr.Button(value="Submit")
|
| 249 |
|
| 250 |
# Outputs
|
|
@@ -262,14 +260,6 @@ def interface():
|
|
| 262 |
# Event Handler for API Key
|
| 263 |
ling_ents_btn.click(update_api_key, inputs=ling_ents_apikey_input)
|
| 264 |
|
| 265 |
-
def update_dropdown(dropdown_prompt, other_prompt):
|
| 266 |
-
if (dropdown_prompt == "Other"):
|
| 267 |
-
return other_prompt
|
| 268 |
-
else:
|
| 269 |
-
return dropdown_prompt
|
| 270 |
-
|
| 271 |
-
ling_ents_btn.click(update_dropdown, inputs=[linguistic_entities, linguistic_entities_other], outputs=[linguistic_entities])
|
| 272 |
-
|
| 273 |
def update_textbox(prompt):
|
| 274 |
return prompt
|
| 275 |
|
|
@@ -300,7 +290,7 @@ def interface():
|
|
| 300 |
- If you selected 'Yes', enter your OpenAI API Key [Link to your OpenAI keys](https://platform.openai.com/api-keys).
|
| 301 |
- If you selected 'No', leave the 'OpenAI Key' field blank and continue with the rest.
|
| 302 |
- Select a Task from the Dropdown.
|
| 303 |
-
- Select a Linguistic Entity from the Dropdown.
|
| 304 |
- Click 'Submit' to send your inputs to the models.
|
| 305 |
- To submit a new prompt, repeat all the steps above and click 'Submit' again. Your new prompt should appear on the top of previous ones.
|
| 306 |
|
|
@@ -329,7 +319,7 @@ def interface():
|
|
| 329 |
have_key = gr.Dropdown(["Yes", "No"], label="Do you own an API Key?", scale=0.5)
|
| 330 |
task_apikey_input = gr.Textbox(label="Open AI Key", placeholder="Enter your OpenAI key here", type="password", visible=True)
|
| 331 |
task = gr.Dropdown(["POS Tagging", "Chunking"], label="Task")
|
| 332 |
-
task_linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"], label="Linguistic Entity For Strategy 1")
|
| 333 |
task_btn = gr.Button(value="Submit")
|
| 334 |
|
| 335 |
# Outputs
|
|
|
|
| 224 |
- If you own an OpenAI API key, select 'Yes' in the dropdown. If you don't own one, select 'No'.
|
| 225 |
- If you selected 'Yes', enter your OpenAI API Key [Link to your OpenAI keys](https://platform.openai.com/api-keys).
|
| 226 |
- If you selected 'No', leave the 'OpenAI Key' field blank and continue with the rest.
|
| 227 |
+
- Select a Linguistic Entity from the Dropdown or enter a custom one.
|
| 228 |
- Click 'Submit' to send your inputs to the models.
|
| 229 |
- To submit a new prompt, repeat all the steps above and click 'Submit' again. Your new prompt should appear on the top of previous ones.
|
| 230 |
|
|
|
|
| 242 |
# Will activate after getting API key
|
| 243 |
have_key2 = gr.Dropdown(["Yes", "No"], label="Do you own an API Key?", scale=0.5)
|
| 244 |
ling_ents_apikey_input = gr.Textbox(label="Open AI Key", placeholder="Enter your Openai key here", type="password")
|
| 245 |
+
linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"], label="Linguistic Entity", allow_custom_value=True, info="If your choice is not included in the options, please type your own.")
|
|
|
|
|
|
|
| 246 |
ling_ents_btn = gr.Button(value="Submit")
|
| 247 |
|
| 248 |
# Outputs
|
|
|
|
| 260 |
# Event Handler for API Key
|
| 261 |
ling_ents_btn.click(update_api_key, inputs=ling_ents_apikey_input)
|
| 262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
def update_textbox(prompt):
|
| 264 |
return prompt
|
| 265 |
|
|
|
|
| 290 |
- If you selected 'Yes', enter your OpenAI API Key [Link to your OpenAI keys](https://platform.openai.com/api-keys).
|
| 291 |
- If you selected 'No', leave the 'OpenAI Key' field blank and continue with the rest.
|
| 292 |
- Select a Task from the Dropdown.
|
| 293 |
+
- Select a Linguistic Entity from the Dropdown or enter a custom one.
|
| 294 |
- Click 'Submit' to send your inputs to the models.
|
| 295 |
- To submit a new prompt, repeat all the steps above and click 'Submit' again. Your new prompt should appear on the top of previous ones.
|
| 296 |
|
|
|
|
| 319 |
have_key = gr.Dropdown(["Yes", "No"], label="Do you own an API Key?", scale=0.5)
|
| 320 |
task_apikey_input = gr.Textbox(label="Open AI Key", placeholder="Enter your OpenAI key here", type="password", visible=True)
|
| 321 |
task = gr.Dropdown(["POS Tagging", "Chunking"], label="Task")
|
| 322 |
+
task_linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"], label="Linguistic Entity For Strategy 1", allow_custom_value=True, info="If your choice is not included in the options, please type your own.")
|
| 323 |
task_btn = gr.Button(value="Submit")
|
| 324 |
|
| 325 |
# Outputs
|