Skip to content

Prediction with API

What is Prediction with API?

Application programming interfaces (APIs) allow products or services to communicate with each other without knowing how AI is implemented, and can simplify application development, saving time and money.

The API provided by CLICK AI enables automation through programming instead of the trouble of obtaining a forecast value every time with the generated artificial intelligence.

1. Use API

이미지이름

1) Select and click on one of the AIs that have been developed. (The selected example above is an AI for predicting graduate admissions used as an example of classifying continuous values ​​of structured data.)

2) Click 'Details'.

3) You can get APIs for each programming language through 'API' in the details.

2. Prediction

1) Single prediction

import requests
import json

url = "https://dslabaa.clickai.ai/159/predict/"

payload = {"modelid":239748,"apptoken":"eovysla",
           "parameter": {"GRE score__ex1_graduate_school_admissions (1).csv":325,
                          "TOEFL score__ex1_graduate_school_admissions (1).csv":100,
                          "school ranking__ex1_graduate_school_admissions (1).csv":1,
                          "GPA__ex1_graduate_school_admissions (1).csv":3,
                          "personal statement__ex1_graduate_school_admissions (1).csv":3,
                          "recommendation__ex1_graduate_school_admissions (1).csv":9,
                          "research experience__ex1_graduate_school_admissions (1).csv":1}}
headers = {
             'content-type': "application/json",
             'cache-control': "no-cache",
           }

response = requests.request("POST", url, data=json.dumps(payload), headers=headers)

print(response.text)

As above, after copying and pasting the API code written in CLICK AI, input the appropriate value for each parameter and run it to get the predicted result.

2) Collective prediction

For the collective prediction test, input the desired value to the graduation rate test.csv file.

이미지이름
[graduation rate test.csv]


import requests
import json

url = "https://dslabaa.clickai.ai/159/predict/"

# sample = 샘플데이터
sample = pd.read_csv('graduation rate test.csv', index_col=0)

for _, row in sample.iterrows():
    payload = {"modelid":239748,"apptoken":"eovysla",
               "parameter": {"GRE score__ex1_graduate_school_admissions (1).csv":row[0],
                          "TOEFL score__ex1_graduate_school_admissions (1).csv":row[1],
                          "school ranking__ex1_graduate_school_admissions (1).csv":row[2],
                          "GPA__ex1_graduate_school_admissions (1).csv":row[3],
                          "personal statement__ex1_graduate_school_admissions (1).csv":row[4],
                          "recommendation__ex1_graduate_school_admissions (1).csv":row[5],
                          "research experience__ex1_graduate_school_admissions (1).csv":row[6]}}
headers = {
             'content-type': "application/json",
             'cache-control': "no-cache",
           }

response = requests.request("POST", url, data=json.dumps(payload), headers=headers)

print(response.text)

You can upload a file and use the API to make collective predictions.