Spaces:
Runtime error
Runtime error
Commit
·
a450a5f
1
Parent(s):
edb0bcd
test
Browse files
app.py
CHANGED
|
@@ -13,20 +13,50 @@ with gr.Blocks() as demo:
|
|
| 13 |
with gr.Tab("POS"):
|
| 14 |
gr.Markdown(" Description ")
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
gr.Markdown("Strategy 1 QA")
|
| 19 |
with gr.Row():
|
| 20 |
vicuna_S1_chatbot_POS = gr.Chatbot(label="vicuna-7b")
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
gr.Markdown("Strategy 2 Instruction")
|
| 23 |
with gr.Row():
|
| 24 |
vicuna_S2_chatbot_POS = gr.Chatbot(label="vicuna-7b")
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
with gr.Row():
|
| 28 |
vicuna_S3_chatbot_POS = gr.Chatbot(label="vicuna-7b")
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
def respond(message, chat_history):
|
| 32 |
input_ids = tokenizer.encode(message, return_tensors="pt")
|
|
@@ -37,8 +67,12 @@ with gr.Blocks() as demo:
|
|
| 37 |
time.sleep(2)
|
| 38 |
return "", chat_history
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
demo.launch()
|
|
|
|
| 13 |
with gr.Tab("POS"):
|
| 14 |
gr.Markdown(" Description ")
|
| 15 |
|
| 16 |
+
prompt_POS = gr.Textbox(show_label=False, placeholder="Write a prompt and press enter")
|
| 17 |
|
| 18 |
gr.Markdown("Strategy 1 QA")
|
| 19 |
with gr.Row():
|
| 20 |
vicuna_S1_chatbot_POS = gr.Chatbot(label="vicuna-7b")
|
| 21 |
+
llama_S1_chatbot_POS = gr.Chatbot(label="llama-7b")
|
| 22 |
+
gpt_S1_chatbot_POS = gr.Chatbot(label="gpt-3.5")
|
| 23 |
+
clear = gr.ClearButton([prompt_POS, vicuna_S1_chatbot_POS])
|
| 24 |
gr.Markdown("Strategy 2 Instruction")
|
| 25 |
with gr.Row():
|
| 26 |
vicuna_S2_chatbot_POS = gr.Chatbot(label="vicuna-7b")
|
| 27 |
+
llama_S2_chatbot_POS = gr.Chatbot(label="llama-7b")
|
| 28 |
+
gpt_S2_chatbot_POS = gr.Chatbot(label="gpt-3.5")
|
| 29 |
+
clear = gr.ClearButton([prompt_POS, vicuna_S2_chatbot_POS])
|
| 30 |
+
gr.Markdown("Strategy 3 Structured Prompting")
|
| 31 |
with gr.Row():
|
| 32 |
vicuna_S3_chatbot_POS = gr.Chatbot(label="vicuna-7b")
|
| 33 |
+
llama_S3_chatbot_POS = gr.Chatbot(label="llama-7b")
|
| 34 |
+
gpt_S3_chatbot_POS = gr.Chatbot(label="gpt-3.5")
|
| 35 |
+
clear = gr.ClearButton([prompt_POS, vicuna_S3_chatbot_POS])
|
| 36 |
+
|
| 37 |
+
with gr.Tab("Chunk"):
|
| 38 |
+
gr.Markdown(" Description ")
|
| 39 |
+
|
| 40 |
+
prompt_CHUNK = gr.Textbox(show_label=False, placeholder="Write a prompt and press enter")
|
| 41 |
+
|
| 42 |
+
gr.Markdown("Strategy 1 QA")
|
| 43 |
+
with gr.Row():
|
| 44 |
+
vicuna_S1_chatbot_CHUNK = gr.Chatbot(label="vicuna-7b")
|
| 45 |
+
llama_S1_chatbot_CHUNK = gr.Chatbot(label="llama-7b")
|
| 46 |
+
gpt_S1_chatbot_CHUNK = gr.Chatbot(label="gpt-3.5")
|
| 47 |
+
clear = gr.ClearButton([msg, vicuna_S1_chatbot_CHUNK])
|
| 48 |
+
gr.Markdown("Strategy 2 Instruction")
|
| 49 |
+
with gr.Row():
|
| 50 |
+
vicuna_S2_chatbot_CHUNK = gr.Chatbot(label="vicuna-7b")
|
| 51 |
+
llama_S2_chatbot_CHUNK = gr.Chatbot(label="llama-7b")
|
| 52 |
+
gpt_S2_chatbot_CHUNK = gr.Chatbot(label="gpt-3.5")
|
| 53 |
+
clear = gr.ClearButton([msg, vicuna_S2_chatbot_CHUNK])
|
| 54 |
+
gr.Markdown("Strategy 3 Structured Prompting")
|
| 55 |
+
with gr.Row():
|
| 56 |
+
vicuna_S3_chatbot_CHUNK = gr.Chatbot(label="vicuna-7b")
|
| 57 |
+
llama_S3_chatbot_CHUNK = gr.Chatbot(label="llama-7b")
|
| 58 |
+
gpt_S3_chatbot_CHUNK = gr.Chatbot(label="gpt-3.5")
|
| 59 |
+
clear = gr.ClearButton([msg, vicuna_S3_chatbot_CHUNK])
|
| 60 |
|
| 61 |
def respond(message, chat_history):
|
| 62 |
input_ids = tokenizer.encode(message, return_tensors="pt")
|
|
|
|
| 67 |
time.sleep(2)
|
| 68 |
return "", chat_history
|
| 69 |
|
| 70 |
+
prompt_POS.submit(respond, [prompt_POS, vicuna_S1_chatbot_POS], [prompt_POS, vicuna_S1_chatbot_POS])
|
| 71 |
+
prompt_POS.submit(respond, [prompt_POS, vicuna_S2_chatbot_POS], [prompt_POS, vicuna_S2_chatbot_POS])
|
| 72 |
+
prompt_POS.submit(respond, [prompt_POS, vicuna_S3_chatbot_POS], [prompt_POS, vicuna_S3_chatbot_POS])
|
| 73 |
+
|
| 74 |
+
prompt_CHUNK.submit(respond, [prompt_CHUNK, vicuna_S1_chatbot_CHUNK], [prompt_CHUNK, vicuna_S1_chatbot_CHUNK])
|
| 75 |
+
prompt_CHUNK.submit(respond, [prompt_CHUNK, vicuna_S2_chatbot_CHUNK], [prompt_CHUNK, vicuna_S2_chatbot_CHUNK])
|
| 76 |
+
prompt_CHUNK.submit(respond, [prompt_CHUNK, vicuna_S3_chatbot_CHUNK], [prompt_CHUNK, vicuna_S3_chatbot_CHUNK])
|
| 77 |
|
| 78 |
demo.launch()
|