{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/rnwnsgud1234/0.Files/anaconda3/envs/nlp/lib/python3.9/site-packages/gradio/inputs.py:26: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n", " warnings.warn(\n", "/home/rnwnsgud1234/0.Files/anaconda3/envs/nlp/lib/python3.9/site-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n", " warnings.warn(value)\n", "/home/rnwnsgud1234/0.Files/anaconda3/envs/nlp/lib/python3.9/site-packages/gradio/deprecation.py:40: UserWarning: `numeric` parameter is deprecated, and it has no effect\n", " warnings.warn(value)\n", "/home/rnwnsgud1234/0.Files/anaconda3/envs/nlp/lib/python3.9/site-packages/gradio/inputs.py:58: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n", " warnings.warn(\n", "/home/rnwnsgud1234/0.Files/anaconda3/envs/nlp/lib/python3.9/site-packages/gradio/interface.py:359: UserWarning: The `allow_flagging` parameter in `Interface` nowtakes a string value ('auto', 'manual', or 'never'), not a boolean. Setting parameter to: 'never'.\n", " warnings.warn(\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7862\n", "Running on public URL: https://bd6b9acba15cf888.gradio.app\n", "\n", "This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" }, { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 1/1 [00:01<00:00, 1.37s/it]\n", "100%|██████████| 1/1 [00:00<00:00, 67.94it/s]\n" ] } ], "source": [ "import gradio as gr\n", "from extraction import paragraph_extract\n", "\n", "def predict(paragraphs, positions):\n", " paragraphs = [paragraphs]\n", " positions = [positions]\n", " return extractor(paragraphs, positions)[0]\n", "\n", "extractor = paragraph_extract().extract\n", "\n", "example_paragraph = 'The W/Zr/HfO2 /TiN structure was fabricated following the scheme shown in the inset of Fig. 1(a). A 5-nm-thick HfO2 layer was deposited on a TiN substrate by an atomic layer deposition system. After HfO2 film deposition, thermal annealing was performed under NH3 at 700∘C in order to achieve optimum concentration of oxygen vacancies [10]. Then, the 3-nm-thick Zr top electrode and a 50-nm-thick W capping layer were deposited by RF magnetron sputtering system. The size of the upper electrode was 10×10 μm2 . The electrical measurements were performed by an Agilent B1500A semiconductor device analyzer, equipped with two pulse generator modules WGFMU (Waveform Generator and Fast Measurement Unit). The coaxial cables with a 50-Ω resistance and less than 10 cm in length were used to reduce the parasitic effects.'\n", "example_position = 4\n", "\n", "demo = gr.Interface(fn=predict, inputs=[gr.inputs.Textbox(lines=3, label=\"Paragraphs\", placeholder='Text Here...'), \n", " gr.inputs.Number(label=\"Positions\")], \n", " outputs=\"text\", \n", " title=\"ReRAM Paragraph Classification\", allow_flagging=False,\n", " examples=[[example_paragraph, example_position]],\n", " )\n", "\n", "demo.launch(share=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.15 ('nlp')", "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.9.15" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "a0944428a9b48e048108e25849b0259875c53ceed2bb9cda9ef2b8036da8c8e0" } } }, "nbformat": 4, "nbformat_minor": 2 }