Spaces:
Runtime error
Runtime error
Commit
·
4d398fe
1
Parent(s):
967d013
removed POS/Chunk tab and enabled llama and vicuna
Browse files
app.py
CHANGED
|
@@ -182,55 +182,7 @@ def llama_strategies_respond(strategy, task_name, task_ling_ent, message, chat_h
|
|
| 182 |
return task_name, "", chat_history
|
| 183 |
|
| 184 |
def interface():
|
| 185 |
-
|
| 186 |
-
# prompt = template_single.format(tab_name, textbox_prompt)
|
| 187 |
-
|
| 188 |
with gr.Tab("Linguistic Entities"):
|
| 189 |
-
gr.Markdown("""
|
| 190 |
-
## 📜 Step-By-Step Instructions
|
| 191 |
-
|
| 192 |
-
- Enter a sentence for three models to process (Vicuna-7b, LLaMA-7b and GPT-3.5).
|
| 193 |
-
- Enter your OpenAI Api Key and click on 'Submit Key'.
|
| 194 |
-
- Select a Linguistic Entity from the Dropdown.
|
| 195 |
-
- Click 'Submit' to send your inputs to the models.
|
| 196 |
-
- Scroll to the bottom and click 'Clear' to start again.
|
| 197 |
-
|
| 198 |
-
### 🤖 Now the models will output the linguistic entities found in your prompt based on your selections!
|
| 199 |
-
""")
|
| 200 |
-
|
| 201 |
-
# Inputs
|
| 202 |
-
ling_ents_prompt = gr.Textbox(show_label=False, placeholder="Write a prompt and press enter")
|
| 203 |
-
ling_ents_apikey_input = gr.Textbox(label="Open AI Key", placeholder="Enter your Openai key here", type="password")
|
| 204 |
-
# ling_ents_apikey_btn = gr.Button(value="Submit Key", scale=0)
|
| 205 |
-
linguistic_entities = gr.Dropdown(["Noun", "Determiner", "Noun phrase", "Verb phrase", "Dependent clause", "T-units"], label="Linguistic Entity")
|
| 206 |
-
ling_ents_btn = gr.Button(value="Submit")
|
| 207 |
-
|
| 208 |
-
# Outputs
|
| 209 |
-
gr.Markdown("### Strategy 1 QA-Based Prompting")
|
| 210 |
-
|
| 211 |
-
linguistic_features_textbox = gr.Textbox(label="Linguistic Features", disabled=True)
|
| 212 |
-
|
| 213 |
-
with gr.Row():
|
| 214 |
-
vicuna_ling_ents_chatbot = gr.Chatbot(label="vicuna-7b")
|
| 215 |
-
llama_ling_ents_chatbot = gr.Chatbot(label="llama-7b")
|
| 216 |
-
gpt_ling_ents_chatbot = gr.Chatbot(label="gpt-3.5")
|
| 217 |
-
clear = gr.ClearButton(components=[ling_ents_prompt, ling_ents_apikey_input, vicuna_ling_ents_chatbot, llama_ling_ents_chatbot, gpt_ling_ents_chatbot])
|
| 218 |
-
|
| 219 |
-
# Event Handler for Vicuna Chatbot
|
| 220 |
-
ling_ents_btn.click(vicuna_respond, inputs=[linguistic_entities, ling_ents_prompt, vicuna_ling_ents_chatbot],
|
| 221 |
-
outputs=[linguistic_entities, ling_ents_prompt, vicuna_ling_ents_chatbot])
|
| 222 |
-
|
| 223 |
-
# Event Handler for LLaMA Chatbot
|
| 224 |
-
ling_ents_btn.click(llama_respond, inputs=[linguistic_entities, ling_ents_prompt, llama_ling_ents_chatbot],
|
| 225 |
-
outputs=[linguistic_entities, ling_ents_prompt, llama_ling_ents_chatbot])
|
| 226 |
-
|
| 227 |
-
# Event Handler for GPT 3.5 Chatbot, user must submit api key before submitting the prompt
|
| 228 |
-
# Will activate after getting API key
|
| 229 |
-
# ling_ents_apikey_btn.click(update_api_key, inputs=ling_ents_apikey_input)
|
| 230 |
-
# ling_ents_btn.click(gpt_respond, inputs=[linguistic_entities, ling_ents_prompt, gpt_ling_ents_chatbot],
|
| 231 |
-
# outputs=[linguistic_entities, ling_ents_prompt, gpt_ling_ents_chatbot])
|
| 232 |
-
|
| 233 |
-
with gr.Tab("POS/Chunking"):
|
| 234 |
gr.Markdown("""
|
| 235 |
## 📜 Step-By-Step Instructions
|
| 236 |
|
|
@@ -278,33 +230,24 @@ def interface():
|
|
| 278 |
vicuna_S3_chatbot, llama_S3_chatbot, gpt_S3_chatbot])
|
| 279 |
|
| 280 |
# Event Handler for API Key
|
| 281 |
-
# def toggle_api_key_input(value):
|
| 282 |
-
# print("toggle_api_key_input ran")
|
| 283 |
-
# if value == "Yes":
|
| 284 |
-
# task_apikey_input.visible = True
|
| 285 |
-
# else:
|
| 286 |
-
# task_apikey_input.visible = False
|
| 287 |
-
|
| 288 |
-
# have_key.input(toggle_api_key_input, inputs=have_key)
|
| 289 |
-
# task_apikey_input.input(update_api_key, inputs=task_apikey_input)
|
| 290 |
task_btn.click(update_api_key, inputs=task_apikey_input)
|
| 291 |
|
| 292 |
# vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_history):
|
| 293 |
# Event Handlers for Vicuna Chatbot POS/Chunk
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
|
| 301 |
# Event Handler for LLaMA Chatbot POS/Chunk
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
|
| 309 |
# Event Handler for GPT 3.5 Chatbot POS/Chunk, user must submit api key before submitting the prompt
|
| 310 |
# Will activate after getting API key
|
|
|
|
| 182 |
return task_name, "", chat_history
|
| 183 |
|
| 184 |
def interface():
|
|
|
|
|
|
|
|
|
|
| 185 |
with gr.Tab("Linguistic Entities"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
gr.Markdown("""
|
| 187 |
## 📜 Step-By-Step Instructions
|
| 188 |
|
|
|
|
| 230 |
vicuna_S3_chatbot, llama_S3_chatbot, gpt_S3_chatbot])
|
| 231 |
|
| 232 |
# Event Handler for API Key
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
task_btn.click(update_api_key, inputs=task_apikey_input)
|
| 234 |
|
| 235 |
# vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_history):
|
| 236 |
# Event Handlers for Vicuna Chatbot POS/Chunk
|
| 237 |
+
task_btn.click(vicuna_strategies_respond, inputs=[strategy1, task, task_linguistic_entities, task_prompt, vicuna_S1_chatbot],
|
| 238 |
+
outputs=[task, task_prompt, vicuna_S1_chatbot])
|
| 239 |
+
task_btn.click(vicuna_strategies_respond, inputs=[strategy2, task, task_linguistic_entities, task_prompt, vicuna_S2_chatbot],
|
| 240 |
+
outputs=[task, task_prompt, vicuna_S2_chatbot])
|
| 241 |
+
task_btn.click(vicuna_strategies_respond, inputs=[strategy3, task, task_linguistic_entities, task_prompt, vicuna_S3_chatbot],
|
| 242 |
+
outputs=[task, task_prompt, vicuna_S3_chatbot])
|
| 243 |
|
| 244 |
# Event Handler for LLaMA Chatbot POS/Chunk
|
| 245 |
+
task_btn.click(llama_strategies_respond, inputs=[strategy1, task, task_linguistic_entities, task_prompt, llama_S1_chatbot],
|
| 246 |
+
outputs=[task, task_prompt, llama_S1_chatbot])
|
| 247 |
+
task_btn.click(llama_strategies_respond, inputs=[strategy2, task, task_linguistic_entities, task_prompt, llama_S2_chatbot],
|
| 248 |
+
outputs=[task, task_prompt, llama_S2_chatbot])
|
| 249 |
+
task_btn.click(llama_strategies_respond, inputs=[strategy3, task, task_linguistic_entities, task_prompt, llama_S3_chatbot],
|
| 250 |
+
outputs=[task, task_prompt, llama_S3_chatbot])
|
| 251 |
|
| 252 |
# Event Handler for GPT 3.5 Chatbot POS/Chunk, user must submit api key before submitting the prompt
|
| 253 |
# Will activate after getting API key
|