Skip to content

Instantly share code, notes, and snippets.

@vuthaihoc
Last active December 18, 2019 06:59
Show Gist options
  • Save vuthaihoc/b921f2d562ddae690b9b0aa9b64f7d08 to your computer and use it in GitHub Desktop.
Save vuthaihoc/b921f2d562ddae690b9b0aa9b64f7d08 to your computer and use it in GitHub Desktop.
AI API requirements

Gen title api:

Method : POST Params :

  • file : file - upload file dạng document
  • url : string - đường dẫn đến file (downloadable)
  • possible[] : array - mảng các title nên đưa thêm vào xem xét (anchor text/page title)
  • no_title : bool - Neu la true thi chi tra ve keywords va references

Response :

{
	"success" : true, //true/false
	"title" : "title detect đk",
	"possible" : [
		{
			"content" : "tieu de abc", // câu có khả năng có thể làm tiêu đề
			"score" : 0.23 // điểm số, thang điểm tùy ý theo hệ thống đã có
		},
		{
			"content" : "tieu de xyz", // câu có khả năng có thể làm tiêu đề
			"score" : 0.23 // điểm số, thang điểm tùy ý theo hệ thống đã có
		},
	],
  "keywords" : "Ames Laboratory; Physics and Astronomy; Electrical and Computer Engineering", // cach nhau dau ;
  "references" : [
     "Lowa State University Library, \"A Strategic Plan for the University Library, 1995–2000\" (1995).Library Reports. 4.http://lib.dr.iastate.edu/libreports/4",
     "Schedule 2 of the Education (School Premises) Regulations 1999, SI 1999/2; The School Premises (England) Regulations 2012, SI 2012/1943",
  ]
}

Figure extraction api

Request

  • Get :
    • Request params :
      • url : url đến file pdf (có thể download bằng wget)
  • Post :
    • Request params : hỗ trợ url giống GET hoặc upload file
      • url (string): url đến file pdf (có thể download bằng wget)
      • file (file): có thể upload file trực tiếp
  • Response : Response chung cho cả loại get/post
    • Định dạng json
    • Cấu trúc json demo
{
   "success" : true,//true/false,
   "message" : "",//Message khi success là false,
   "total" : 10,//tổng số hình ảnh/bảng detect được của 1 tài liệu
   "detected" : [
      //{…item},
      //{…item},
      //...
   ]
}
  • Cấu trúc item
{
	"type" : "figure",//figure/table/image/graph/…,
        "page" : 10,// trang phát hiện item
        "page-width" : 800, // chiều rộng của page tính bằng px
        "reliability" : 1, // khả năng item detect được là chính xác, mức độ chính xác theo tính toán bên AI, max là 1
        "position" : {
		"x-top" : 100,
		"y-top" : 100,
		"x-bottom" : 200,
		"y-bottom" : 200,
	},
        "caption" : "Figure 1 : Cation here",//caption detect được đi kèm với item,
        "caption-reliability" : 1, // khả năng caption detect được là chính xác, mức độ chính xác theo tính toán bên AI, max là 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment