Skip to content

Commit 2a86ee6

Browse files
author
DocMinus
committed
simplified install, updateon curl testing
1 parent b14a1b5 commit 2a86ee6

File tree

7 files changed

+42
-36
lines changed

7 files changed

+42
-36
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# IDE and environment directories
2-
**/.idea/
2+
**/.idea
33
**/__pycache__
44
**/.ipynb_checkpoints
55
**/image*.svg
@@ -9,10 +9,12 @@
99
**/.conda
1010
**/.env
1111
**/.venv
12-
**/env/
13-
**/venv/
12+
**/env
13+
**/venv
1414
/.temp
1515

16+
**/optional_standalone_no_server
17+
1618
# installer files
1719
**/*egg-info
1820
**/*.egg

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,20 @@ pip install ./packages/decimerapi/
5757
```
5858

5959
### For local version (full install)
60-
Best results with python3.10, at least on Mac M models. Py 3.9 on Mac with gpu support doesn't seenm to work (for me), the non GPU version should be fine on any Py version.<br>
61-
Other python versions on Linux according to DECIMER authors should be fine?<br>
60+
Note, that due to Tensorflow not all pyton version on Mac or Win seem to work without issues, although on Linux all >=3.9 should be fine.<br>
61+
Esp. for Mac, if GPU usage is desired, 3.10.0 works best (for me).<br>
62+
63+
#### Linux/Windows:
64+
```shell
65+
conda env create -f environment.yml
66+
conda activate decimerserver
67+
```
68+
69+
#### Mac Darwin/Silicone:
6270
```shell
63-
conda create --name decimerserver python=3.10.0 # or other if you don't want/need Mac GPU support
71+
conda env create -f environment_mac.yml
6472
conda activate decimerserver
6573
```
66-
Linux/Windows: ```pip install -r requirements.txt``` <br>
67-
Mac Darwin/Silicon: ```pip install -r requirements_mac.txt``` <br>
6874

6975
## Usage
7076
### Docker

decimer_server.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,30 +128,3 @@ async def image_to_smiles(
128128

129129
uvicorn.run(app, host="0.0.0.0", port=8099)
130130

131-
"""
132-
To test the server, on cmd line use:
133-
Note, esp. for docker, the path you submitt depends on the volume (name) you mount.
134-
curl -X POST "http://localhost:8099/image2smiles/" -d "temporaryfile=/yourpath/image.jpg" -d "is_hand_drawn=true"
135-
136-
http request would look like this:
137-
<!DOCTYPE html>
138-
<html>
139-
<head>
140-
<title>Test POST Request</title>
141-
</head>
142-
<body>
143-
<form action="http://localhost:8099/image2smiles/" method="post">
144-
<label for="temporaryfile">Temporary File Path:</label>
145-
<input type="text" id="temporaryfile" name="temporaryfile" value="/yourpath/image.jpg"><br><br>
146-
<label for="is_hand_drawn">Is Hand Drawn:</label>
147-
<input type="checkbox" id="is_hand_drawn" name="is_hand_drawn" value="true"><br><br>
148-
<input type="submit" value="Submit">
149-
</form>
150-
</body>
151-
</html>
152-
153-
And in python:
154-
url = "http://localhost:8099/image2smiles/"
155-
data = {"temporaryfile": tempfilename, "is_hand_drawn": str(hand_drawn).lower()}
156-
response = requests.post(url, data=data)
157-
"""

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# version: '3.3' # use only for older docker compose versions
2+
13
services:
24
decimer_api:
35
image: docker.io/docminus/decimer_api:latest # for dockerhub image

environment.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: decimerserver
2+
channels:
3+
- defaults
4+
dependencies:
5+
- python=3.11.9
6+
- pip
7+
- pip:
8+
- -r requirements.txt

environment_mac.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: decimerserver
2+
channels:
3+
- defaults
4+
dependencies:
5+
- python=3.10.0
6+
- pip
7+
- pip:
8+
- -r requirements_mac.txt

readme_api_calls.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ print(smiles)
1717

1818

1919
# API calls without decimerapi
20-
should you want to use the local server directly, without using any package installs, here are 2 examples:<br>
20+
Should you want to use the local server directly, without using any api package usage, here are 2 examples:<br>
21+
## Python
2122
Check the server status:
2223
```python
2324
import requests
@@ -49,4 +50,10 @@ else:
4950
response_json = response.json()
5051
analyzed_smiles = response_json["smiles"]
5152
print(analyzed_smiles)
53+
```
54+
55+
## Curl
56+
To test the server, on cmd line use:
57+
```Shell
58+
curl -X GET "http://localhost:8099/"
5259
```

0 commit comments

Comments
 (0)