File size: 5,113 Bytes
dc07399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
 "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": [
       "<div><iframe src=\"https://bd6b9acba15cf888.gradio.app\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "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
}