{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# PINECONE_API_KEY = 7b886e48-e3d3-4644-bf8d-74b94d49c18c\n", "# PINECONE_ENV = gcp-starter" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/aakashbhatnagar/Documents/masters/LLM/myenv/lib/python3.10/site-packages/pinecone/index.py:4: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from tqdm.autonotebook import tqdm\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Downloading model\n", "\n", "\n", "Models downloaded\n" ] } ], "source": [ "from rag import fetch_top_k" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Pseudophakia is the loss of:\n", "A. Accommodation\n", "B. Conversion\n", "C. Saccadic eye movements\n", "D. Contrast sensitivity" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7861\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n", "To disable this warning, you can either:\n", "\t- Avoid using `tokenizers` before the fork if possible\n", "\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Running on public URL: https://49a86c835b55baa011.gradio.live\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import gradio as gr\n", "\n", "gr.ChatInterface(fetch_top_k).launch(share=True)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...\n", "To disable this warning, you can either:\n", "\t- Avoid using `tokenizers` before the fork if possible\n", "\t- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Need \u001b[32m'write'\u001b[0m access token to create a Spaces repo.\n", "\n", " _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_|\n", " _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n", " _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_|\n", " _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _|\n", " _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_|\n", " \n", " To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .\n", "Token: \n", "\u001b[31mAborted.\u001b[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "['side of scotoma, the seotoma\\n‘moves in opposite direction (ce.\\n‘towards the fixation point). The\\nobjects tend to appear and,\\ndisappear in the most discon-\\ncerting way, hence called |\\n“Jack-in-box phenomenon”.\\n\\n5. Pin-cushion effect due to |\\napherical aberrations. In this\\ncondition the straight lines\\nhecome curves and linear becomes «', \"2. Inflteating tumors !\\n2. Burns '\\n4. Radiotherapy or Cryotherapy of lid *\\n‘umors ,\\n», Skin\\n=\\n1, Peoria !\\n2 Generalized alopecia, :\\n©. Systemie:\\n1. Myxoedema, P\\n2. Leprosy. ;\\n3. Syphilis :\\n4. SLE. ;\\n4. Following Removal :\\n1 Iatrogenie trichiasis. !\\n2 Trichotillomania, :\\nPotiosis\\nWhitening of eye lashes is known as polioss.\\nCauses: ‘\\na. Local :\", 'ab Dacryocystorhinostomy ia a\\nprocedure in which we make a\\nfistula between the lacrimal sae and\\nthe middle mestus of nose.\\nCrocodile tears are a complication\\nof VII nerve palay. It occurs due to\\nfaulty regeneration of parasym-\\npathetic fibres which now supply\\nthe lacrimal glands instead of\\nsalivary glands\\n|. b Tear formation occurs at six weeks']\n", "['componed predominantly of eos\\nmon\\ni. Mle form: Both inbal nd pal\\nbea conunetes sree\\n+ Comal Changes in VEC!\\nb. Macrocroion ;\\n© Plague ie he desiccated mucus\\nvette epihlal macrelne\\nd. Subepithelial scarring: Wt is\\nsenate tag\\n. Preudogerantomn: Ie renemblea\\necw seni hihi sled\\n‘oar hone the sae Tet\\nStd Cupiarbow\\n{ Kerstocmus may be abated. &', 'A Laminar dot ign\\nB, Nasal abifting of vessla\\nC. Bayonettingsign\\nD, Allofthe above\\n‘\\n\\nzz PI\\nA. ants B. Adak\\nC. Cornealopacties D. Allofthe above\\n\\x0c\\neviwofOpiaiigy\\nA. Autorfractonute\\n3. Automated porinet\\n€. Goldana perimeter\\nD. Kinetiperinetry\\n| The following investigation i\\n@ fi\\n= ff\\n¢\\n[ 7_ /\\n\\\\ |\\nA. Listes perimetry\\n1. Goldmann perimete', 'D. Selermalacnperirans\\n¥ )\\n| a\\nue I\\n\\x0c\\neins of Otte\\nB. Groce dosoy\\n©. Kenzer\\nD Keronlada\\nith ey hich rnin woken\\not the eyeball The presence\\ntneeeaed TOP contin\\nfart apy\\nA Normal Bosan\\n Powaie ari\\nRanda\\nD. Poe\\n4. Thediagnossi\\n\"i in\\ni ee a\\nA sus haenoras\\n1 Poseraesaptnoma\\n© Bruna aapyione\\nD Pater']\n", "['componed predominantly of eos\\nmon\\ni. Mle form: Both inbal nd pal\\nbea conunetes sree\\n+ Comal Changes in VEC!\\nb. Macrocroion ;\\n© Plague ie he desiccated mucus\\nvette epihlal macrelne\\nd. Subepithelial scarring: Wt is\\nsenate tag\\n. Preudogerantomn: Ie renemblea\\necw seni hihi sled\\n‘oar hone the sae Tet\\nStd Cupiarbow\\n{ Kerstocmus may be abated. &', 'A Laminar dot ign\\nB, Nasal abifting of vessla\\nC. Bayonettingsign\\nD, Allofthe above\\n‘\\n\\nzz PI\\nA. ants B. Adak\\nC. Cornealopacties D. Allofthe above\\n\\x0c\\neviwofOpiaiigy\\nA. Autorfractonute\\n3. Automated porinet\\n€. Goldana perimeter\\nD. Kinetiperinetry\\n| The following investigation i\\n@ fi\\n= ff\\n¢\\n[ 7_ /\\n\\\\ |\\nA. Listes perimetry\\n1. Goldmann perimete', 'D. Selermalacnperirans\\n¥ )\\n| a\\nue I\\n\\x0c\\neins of Otte\\nB. Groce dosoy\\n©. Kenzer\\nD Keronlada\\nith ey hich rnin woken\\not the eyeball The presence\\ntneeeaed TOP contin\\nfart apy\\nA Normal Bosan\\n Powaie ari\\nRanda\\nD. Poe\\n4. Thediagnossi\\n\"i in\\ni ee a\\nA sus haenoras\\n1 Poseraesaptnoma\\n© Bruna aapyione\\nD Pater']\n", "['. Preuopyoeyanca\\nD. Propionabacterium\\n57. All are risk factors for catarac\\nexcept\\n‘A. Dishetes mellitus\\nB. Hypertension\\n. Sioking\\nD, Recurrent diarehoea', 'catarat is retinal pathologies. Retinal\\ndegenerations and other fundal\\nchanges is a feature of pathological\\n‘myopia but not of hypermetropia,\\n\\nfd Refractive index is maximum atthe\\ncontre ofthe lens where the nucles\\nis hard compared tothe cortex\\n\\n5. a Endophytic retinoblastoma (which\\n‘rows towards the vitreous) may lead\\nto dislocation of the lens.', 'te i meno\\ntw Tn cs ales\\nPour avin ener ose Ti\\nBaran Cone dna, eons Ie\\nSheil melanme,retblawa |\\nfd eur hypuony at h\\nIroc pean or psrtion ef\\nee\\n\\n:\\n\\nClinical Features:\\n\\n4. Pontos: Opacin in the vious i\\nIon ns fotera, fe meus ie to\\nAiprios of pigs a a\\nPion piel celle Ti rot in\\n‘Repmatopenan Rand inv ane\\nSteutatne RD (ve to proce af']\n" ] } ], "source": [ "!gradio deploy" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['side of scotoma, the seotoma\\n‘moves in opposite direction (ce.\\n‘towards the fixation point). The\\nobjects tend to appear and,\\ndisappear in the most discon-\\ncerting way, hence called |\\n“Jack-in-box phenomenon”.\\n\\n5. Pin-cushion effect due to |\\napherical aberrations. In this\\ncondition the straight lines\\nhecome curves and linear becomes «', 'D. Selermalacnperirans\\n¥ )\\n| a\\nue I\\n\\x0c\\neins of Otte\\nB. Groce dosoy\\n©. Kenzer\\nD Keronlada\\nith ey hich rnin woken\\not the eyeball The presence\\ntneeeaed TOP contin\\nfart apy\\nA Normal Bosan\\n Powaie ari\\nRanda\\nD. Poe\\n4. Thediagnossi\\n\"i in\\ni ee a\\nA sus haenoras\\n1 Poseraesaptnoma\\n© Bruna aapyione\\nD Pater', \"2. Soro-nogative arthropathies :\\n\\x0c\\nog\\n\\n+ Reiter's syndrome.\\n+ Ankylosing spondylitis\\n+ Poriti arthritis\\n+ aka,\\n\\n| Taftanamatory bowel disease.\\n\\n| Puch’ hetroehromi cyl\\n\\n. Viral (HSV, HZ0) keratouveits\\n\\nPosner Schloeeman syndrome\\n\\n‘auses of Panuveitis\\nSympathetic ophehalmiti\\n\\n- Saroidot\\n\\n- Syphilis\\n\\n. Vogt Koyanagi Harada syndrome\\n\\n Tuberculoi\"]\n" ] } ], "source": [ "a = fetch_top_k(\"What is the meaning of life?\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "str" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(a)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'side of scotoma, the seotoma\\n‘moves in opposite direction (ce.\\n‘towards the fixation point). The\\nobjects tend to appear and,\\ndisappear in the most discon-\\ncerting way, hence called |\\n“Jack-in-box phenomenon”.\\n\\n5. Pin-cushion effect due to |\\napherical aberrations. In this\\ncondition the straight lines\\nhecome curves and linear becomes «\\nD. Selermalacnperirans\\n¥ )\\n| a\\nue I\\n\\x0c\\neins of Otte\\nB. Groce dosoy\\n©. Kenzer\\nD Keronlada\\nith ey hich rnin woken\\not the eyeball The presence\\ntneeeaed TOP contin\\nfart apy\\nA Normal Bosan\\n Powaie ari\\nRanda\\nD. Poe\\n4. Thediagnossi\\n\"i in\\ni ee a\\nA sus haenoras\\n1 Poseraesaptnoma\\n© Bruna aapyione\\nD Pater\\n2. Soro-nogative arthropathies :\\n\\x0c\\nog\\n\\n+ Reiter\\'s syndrome.\\n+ Ankylosing spondylitis\\n+ Poriti arthritis\\n+ aka,\\n\\n| Taftanamatory bowel disease.\\n\\n| Puch’ hetroehromi cyl\\n\\n. Viral (HSV, HZ0) keratouveits\\n\\nPosner Schloeeman syndrome\\n\\n‘auses of Panuveitis\\nSympathetic ophehalmiti\\n\\n- Saroidot\\n\\n- Syphilis\\n\\n. Vogt Koyanagi Harada syndrome\\n\\n Tuberculoi'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "myenv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" } }, "nbformat": 4, "nbformat_minor": 2 }