derek-thomas
commited on
Commit
·
255eeab
1
Parent(s):
686ffce
Updating for falcon
Browse files- 01-poe-dataset-creation.ipynb +0 -109
01-poe-dataset-creation.ipynb
CHANGED
@@ -1437,115 +1437,6 @@
|
|
1437 |
"Note: Its tricky as I cant easily render newlines in strings. So be careful!"
|
1438 |
]
|
1439 |
},
|
1440 |
-
{
|
1441 |
-
"cell_type": "code",
|
1442 |
-
"execution_count": 22,
|
1443 |
-
"id": "a50d9d6c-18e6-476d-9a40-ed7a3f699477",
|
1444 |
-
"metadata": {
|
1445 |
-
"tags": []
|
1446 |
-
},
|
1447 |
-
"outputs": [
|
1448 |
-
{
|
1449 |
-
"name": "stdout",
|
1450 |
-
"output_type": "stream",
|
1451 |
-
"text": [
|
1452 |
-
"* Running on local URL: http://127.0.0.1:7860\n",
|
1453 |
-
"\n",
|
1454 |
-
"To create a public link, set `share=True` in `launch()`.\n"
|
1455 |
-
]
|
1456 |
-
},
|
1457 |
-
{
|
1458 |
-
"data": {
|
1459 |
-
"text/html": [
|
1460 |
-
"<div><iframe src=\"http://127.0.0.1:7860/\" width=\"100%\" height=\"900\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
1461 |
-
],
|
1462 |
-
"text/plain": [
|
1463 |
-
"<IPython.core.display.HTML object>"
|
1464 |
-
]
|
1465 |
-
},
|
1466 |
-
"metadata": {},
|
1467 |
-
"output_type": "display_data"
|
1468 |
-
},
|
1469 |
-
{
|
1470 |
-
"data": {
|
1471 |
-
"text/plain": []
|
1472 |
-
},
|
1473 |
-
"execution_count": 22,
|
1474 |
-
"metadata": {},
|
1475 |
-
"output_type": "execute_result"
|
1476 |
-
}
|
1477 |
-
],
|
1478 |
-
"source": [
|
1479 |
-
"import json\n",
|
1480 |
-
"import gradio as gr\n",
|
1481 |
-
"\n",
|
1482 |
-
"# Gradio app to browse prompts with left and right buttons\n",
|
1483 |
-
"# index = 0\n",
|
1484 |
-
"\n",
|
1485 |
-
"# Functions to handle prompts\n",
|
1486 |
-
"def get_prompt(index, prompt_type):\n",
|
1487 |
-
" return df.iloc[index][prompt_type]\n",
|
1488 |
-
"\n",
|
1489 |
-
"def next_prompt(index, prompt_type):\n",
|
1490 |
-
" if index < len(df) - 1:\n",
|
1491 |
-
" index += 1\n",
|
1492 |
-
" return index, get_prompt(index, prompt_type)\n",
|
1493 |
-
"\n",
|
1494 |
-
"def previous_prompt(index, prompt_type):\n",
|
1495 |
-
" if index > 0:\n",
|
1496 |
-
" index -= 1\n",
|
1497 |
-
" return index, get_prompt(index, prompt_type)\n",
|
1498 |
-
"\n",
|
1499 |
-
"# Gradio App\n",
|
1500 |
-
"with gr.Blocks() as demo:\n",
|
1501 |
-
" gr.Markdown(\"# Prompt Browser\")\n",
|
1502 |
-
" with gr.Row():\n",
|
1503 |
-
" prompt_type_dropdown = gr.Dropdown(\n",
|
1504 |
-
" choices=['conversation_RFA_gpt3_5', 'conversation_RFA_falcon', 'conversation_FAR_gpt3_5', 'conversation_FAR_falcon', 'conversation_FA'],\n",
|
1505 |
-
" value='conversation_RFA_gpt3_5',\n",
|
1506 |
-
" label=\"Select Prompt Type\"\n",
|
1507 |
-
" )\n",
|
1508 |
-
" index_display = gr.Textbox(\"0\", label=\"Index\", interactive=False)\n",
|
1509 |
-
"\n",
|
1510 |
-
" prompt_display = gr.JSON(value=df.iloc[0]['conversation_RFA_gpt3_5'], label=\"Prompt\")\n",
|
1511 |
-
" \n",
|
1512 |
-
" with gr.Row():\n",
|
1513 |
-
" prev_button = gr.Button(\"⬅️ Previous\")\n",
|
1514 |
-
" next_button = gr.Button(\"Next ➡️\")\n",
|
1515 |
-
" \n",
|
1516 |
-
" # State to hold the current index\n",
|
1517 |
-
" index_state = gr.State(value=0)\n",
|
1518 |
-
"\n",
|
1519 |
-
" # Button click events\n",
|
1520 |
-
" prev_button.click(\n",
|
1521 |
-
" fn=previous_prompt,\n",
|
1522 |
-
" inputs=[index_state, prompt_type_dropdown],\n",
|
1523 |
-
" outputs=[index_state, prompt_display]\n",
|
1524 |
-
" )\n",
|
1525 |
-
" next_button.click(\n",
|
1526 |
-
" fn=next_prompt,\n",
|
1527 |
-
" inputs=[index_state, prompt_type_dropdown],\n",
|
1528 |
-
" outputs=[index_state, prompt_display]\n",
|
1529 |
-
" )\n",
|
1530 |
-
"\n",
|
1531 |
-
" # Dropdown change event\n",
|
1532 |
-
" prompt_type_dropdown.change(\n",
|
1533 |
-
" fn=lambda index, prompt_type: get_prompt(index, prompt_type),\n",
|
1534 |
-
" inputs=[index_state, prompt_type_dropdown],\n",
|
1535 |
-
" outputs=prompt_display\n",
|
1536 |
-
" )\n",
|
1537 |
-
"\n",
|
1538 |
-
" # Update index display\n",
|
1539 |
-
" index_state.change(\n",
|
1540 |
-
" fn=lambda index: str(index),\n",
|
1541 |
-
" inputs=index_state,\n",
|
1542 |
-
" outputs=index_display\n",
|
1543 |
-
" )\n",
|
1544 |
-
"\n",
|
1545 |
-
"# Launch the app\n",
|
1546 |
-
"demo.launch(height=900)"
|
1547 |
-
]
|
1548 |
-
},
|
1549 |
{
|
1550 |
"cell_type": "code",
|
1551 |
"execution_count": 23,
|
|
|
1437 |
"Note: Its tricky as I cant easily render newlines in strings. So be careful!"
|
1438 |
]
|
1439 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1440 |
{
|
1441 |
"cell_type": "code",
|
1442 |
"execution_count": 23,
|