Skip to content

Commit 73b6c03

Browse files
committed
how to use the local installation
1 parent bf894e7 commit 73b6c03

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ bash start_bern2.sh
7777

7878
## Using BERN2
7979

80-
After running BERN2 successfully in your local environment, you can use it via RESTful API.
81-
If you want to use BERN2 without locally installing it, please check out [here](http://bern2.korea.ac.kr/documentation#api_content) for using the web service.
80+
After successfully running BERN2 in your local environment, you can access it via RESTful API.
81+
If you want to use BERN2 without installing it locally, please see [here](http://bern2.korea.ac.kr/documentation#api_content) for instructions on how to use the web service.
8282

8383
### Plain Text as Input
8484
```

app/templates/local_content.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h3>Installing BERN2</h3>
3434
<div class="py-2">
3535
Then, you need to download resources (e.g., external modules or dictionaries) for running BERN2.
3636
Note that you will need 70GB of free disk space.
37-
If the link below does not work, please download the resources [here](https://drive.google.com/file/d/1BtCA_DDiASl8Qa17ybAnmvdqp4tuc0nN/view?usp=sharing).
37+
If the link below does not work, please download the resources <a href="https://drive.google.com/file/d/1BtCA_DDiASl8Qa17ybAnmvdqp4tuc0nN/view?usp=sharing">here</a>.
3838
</div>
3939
<div class="py-2">
4040
<pre>
@@ -48,6 +48,7 @@ <h3>Installing BERN2</h3>
4848
make install
4949
cd ../../..
5050
</pre>
51+
</div>
5152
<hr>
5253
<div class="py-4">
5354
<h3>Running BERN2</h3>
@@ -66,11 +67,43 @@ <h3>Running BERN2</h3>
6667
(Optional) To restart BERN2, you need to run the following commands.
6768
</div>
6869
<div class="py-2">
69-
<pre>
70+
<pre>
7071
export CUDA_VISIBLE_DEVICES=0
7172
cd scripts
7273
bash stop_bern2.sh
7374
bash start_bern2.sh
7475
</pre>
7576
</div>
77+
<div class="py-4">
78+
<h3>Use BERN2</h3>
79+
</div>
80+
<div class="py-2">
81+
After successfully running BERN2 in your local environment, you can access it via RESTful API.
82+
Except for the url (use http://localhost:8888 instead of http://bern2.korea.ac.kr), the usage of the local installation is exactly the same as that of the <a href="#api_content" class="nav-link active" data-toggle="tab">web service</a>.
83+
</div>
84+
<div class="py-2">
85+
<p class="font-weight-bold">Plain Text as Input</p>
86+
<pre>
87+
import requests
88+
89+
def query_plain(text, url="http://localhost:8888/plain"):
90+
return requests.post(url, json={'text': text}).json()
91+
92+
if __name__ == '__main__':
93+
text = "Autophagy maintains tumour growth through circulating arginine."
94+
print(query_plain(text))
95+
</pre>
96+
</div>
97+
<div class="py-2">
98+
<p class="font-weight-bold">PubMed ID (PMID) as Input</p>
99+
<pre>
100+
import requests
101+
102+
def query_pmid(pmids, url="http://localhost:8888/pubmed"):
103+
return requests.get(url + "/" + ",".join(pmids)).json()
104+
105+
if __name__ == '__main__':
106+
pmids = ["30429607", "29446767"]
107+
print(query_pmid(pmids))
108+
</pre>
76109
</div>

0 commit comments

Comments
 (0)