afiz commited on
Commit
c9727ad
1 Parent(s): a5b9ab5

Upload oneai.py

Browse files
Files changed (1) hide show
  1. oneai.py +33 -0
oneai.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Edit this One AI API call using our studio at https://studio.oneai.com/?pipeline=j2Yiyk
2
+
3
+
4
+ import requests
5
+ from pprint import pprint
6
+ from config import api_key
7
+
8
+ url = "https://api.oneai.com/api/v0/pipeline"
9
+
10
+
11
+ def oneai_pipeline(text):
12
+ headers = {
13
+ "api-key": api_key,
14
+ "content-type": "application/json"
15
+ }
16
+ payload = {
17
+ "input": text,
18
+ "input_type": "article",
19
+ "steps": [
20
+ {
21
+ "skill": "summarize",
22
+ "params": {
23
+ "auto_length": True,
24
+ "max_length": 100,
25
+ "min_length": 5
26
+ }
27
+ },
28
+
29
+ ]
30
+ }
31
+ r = requests.post(url, json=payload, headers=headers)
32
+ data = r.json()
33
+ return data['output'][0]['text']