Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT][API] Get the projections of records and avatars in 3D #80

Open
youen opened this issue Mar 31, 2024 · 0 comments
Open

[FEAT][API] Get the projections of records and avatars in 3D #80

youen opened this issue Mar 31, 2024 · 0 comments

Comments

@youen
Copy link
Collaborator

youen commented Mar 31, 2024

Description

This feature allows you to retrieve the projections of records and avatars in 3D for a given job ID.

Request

Method

GET

URL

/projections/{job_id}

Request Parameters

Parameter Description Required Example
job_id The avatarization or privacy job ID used to fit the model Yes 123456789

Request Body

None

Result

Result parameters

Parameter Description Type Example
records List of list of float representing the records List[List[float]] [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]
avatars List of list of float representing the avatars List[List[float]] [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]]

Result Body

The result is a JSON object with the following structure:

{
  "records": [
    [0.1, 0.2, 0.3],
    [0.4, 0.5, 0.6]
  ],
  "avatars": [
    [0.1, 0.2, 0.3],
    [0.4, 0.5, 0.6]
  ]
}

Example Curl Request

Request

curl -X GET "http://localhost:8080/projections/123456789"

Curl Response

{
  "records": [
    [0.1, 0.2, 0.3],
    [0.4, 0.5, 0.6]
  ],
  "avatars": [
    [0.1, 0.2, 0.3],
    [0.4, 0.5, 0.6]
  ]
}

Go server

Struct

type Projections struct {
	Records [][]float64 `json:"records"`
	Avatars [][]float64 `json:"avatars"`
}

Handler

func (s *Server) getJobProjections(w http.ResponseWriter, r *http.Request) {
	jobID := mux.Vars(r)["job_id"]

	projections, err := s.avatarService.GetJobProjections(r.Context(), jobID)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	json.NewEncoder(w).Encode(projections)
}

Links

Automated Issue Details

Dear visitor,

This issue has been automatically generated from the Octopize project avatar-python to make SIGO compatible. Please vote with a thumbs up or thumbs down to assess the quality of the automatic generation.

Best regards,
The SIGO Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant