stefan-insilico commited on
Commit
4112d91
·
verified ·
1 Parent(s): 58fd3fd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +61 -0
README.md CHANGED
@@ -50,6 +50,67 @@ Another example - predict compound based on signature. You can take
50
  }
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  ```
54
 
55
  ---
 
50
  }
51
  }
52
 
53
+ ```
54
+ ---
55
+
56
+ ## Run generation
57
+
58
+
59
+ ### Step 1.
60
+ ```python
61
+
62
+ import requests
63
+
64
+ API_URL = "https://cu2s6lgb4jew3tht.us-east-1.aws.endpoints.huggingface.cloud"
65
+ headers = {
66
+ "Accept" : "application/json",
67
+ "Authorization": "Bearer hf_XXXX",
68
+ "Content-Type": "application/json"
69
+ }
70
+
71
+ def query(payload):
72
+ response = requests.post(API_URL, headers=headers, json=payload)
73
+ return response.json()
74
+
75
+ ```
76
+
77
+ ### Step 2.
78
+
79
+ ```python
80
+ import json
81
+ with open('./generation-configs/meta2diff.json', 'r') as f:
82
+ config_data = json.load(f)
83
+
84
+ # prepare sample
85
+ config_sample = {"inputs": config_data, "mode": "diff2compound", "parameters": {
86
+ "temperature": 0.4,
87
+ "top_p": 0.2,
88
+ "top_k": 3550,
89
+ "n_next_tokens": 50
90
+ }}
91
+
92
+ ```
93
+
94
+ ### Step 2 - prepared configuration
95
+ ```json
96
+ {
97
+ "inputs": {
98
+ "instruction": "disease2diff2disease",
99
+ "tissue": ["whole blood"],
100
+ "cell": "u937 ",
101
+ "efo": "Orphanet_139399",
102
+ "datatype": "", "drug": "", "dose": "", "time": "", "case": "", "control": "", "age": "", "dataset_type": "expression ", "gender": "m ", "species": "human ", "up": [], "down": []
103
+ },
104
+ "mode": "meta2diff2compound",
105
+ "parameters": {
106
+ "temperature": 0.8, "top_p": 0.2, "top_k": 3550, "n_next_tokens": 50
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Step 3. Send request to endpoint
112
+ ```python
113
+ output = query(config_sample)
114
  ```
115
 
116
  ---