mirror of
https://github.com/photoprism/photoprism.git
synced 2025-10-06 09:19:33 +08:00
Initial proof-of-concept
This commit is contained in:
17
cmd/tensorflowapi/utilities.go
Normal file
17
cmd/tensorflowapi/utilities.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func responseError(w http.ResponseWriter, message string, code int) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
json.NewEncoder(w).Encode(map[string]string{"error": message})
|
||||
}
|
||||
|
||||
func responseJSON(w http.ResponseWriter, data interface{}) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(data)
|
||||
}
|
Reference in New Issue
Block a user