From 3247c0ea230979557098c5f3b83f47c15cb05958 Mon Sep 17 00:00:00 2001 From: BurdujaAdrian Date: Wed, 30 Oct 2024 20:42:22 +0200 Subject: [PATCH] added images into response, from server-app/recognised_ a --- database/pb_data/logs.db | Bin 1400832 -> 1400832 bytes database/server.go | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/database/pb_data/logs.db b/database/pb_data/logs.db index 84b933d9dd1ae123916e705ad2758e967d11fec4..b9d70e5dd3efd39bf45efc5e8ff71bc75d4a08ee 100644 GIT binary patch delta 4596 zcmd5=Yj6|S72aKGb@g7$$S$>^V_K%6xXAm^W94=OCQwfcO`rwBlr~tBZN06PEm@M2 ziJjP(_D2vz!0oh6#_p7cAJEtq*cfAD1L-53$v~%*wh7aaOr{M@Nv2K6Oc^Hay(`y_ zgp`@&SA6Fjt-mvSzdh%kJ?GvXnBP4xzx!~#sg)qeJp@4*(C@d7taFjA<832Nt7rtN zn0JsSA7bt>?=$ac=fE!drh0+6om<8JrEYLjmen?Dzk9$fNxg|c%o~k(dplF%b{3LP zQX2u!+HH0x533CNJFwxt6&o8lc7wn+aAGs-Z06lIp69>Ev%Gyn89YDDJ51XV_k&pp zJ%T>#Mp~D(>zTbojp;qYJZyfKQ8NqXxcL?HYUXA0nE3_Md(0^_&%AB^srmcnRw03`V^@F;A+`k?3`Y68;WwLAgEZ?u^BgeG$34uQMJ1GZ>UJ zV%qO;rJSsn4Wz^1JO-Wp>3A~eceA~6pevr?z%)krj)-CzoX-nih3#M--i;sJ+05df1I^r!klVY|1l)6pwbEfL|f>aknGR+2bC6k0^&ST|RIcfkAg~BI8fS<6KzwJ9}N=6lRL@=^z(O zIrwz95Q+xD6%0CgFQ15d{h=`H^F;&TG6voLP$ZMEr=#5oU)t#fmz3LsVz35Hn!e zY*w2$6h^M0ZC&2m_EiA6H&wfkSMbPAeUbumxt7<~Liv}*W(v&0HI!*T1uno*#`FUU z%s|hG9{rw&^B=08T?x*aHxRW{>(*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#GCpWzgpqNqkr6`1cq1c-4Pbbsk@FH7 zvbmA585t`Z8Jm!?xRJ3D8FLyL-$nnDrJpx)HX!F(BjZJNsPZs=TIW+bpVWC$=My>~ z*ZG*n9Y-A~NqZ|ff9U9H#_dJxCt#!bvT2p!?DYIj@U{WHgvRjc;4Syhn+6=V4$OiF zF|gZWFqIA0@u0KNv*U?vOLsnN8|uE>>b4Gbj|zgo@gh%;d~4Tg8&b^M9~Xq&u(WHV zwcGmg$V-AC^J#LpZ)`EDUl@661dNrne(l?EL3rTl{MD8Hol8S<0-l&-cg!Cy?`HMH z5k(LRg_`K&E0RCVaNbfx?+H(KwoPd>{slm1%)EYj-W_+p8LeX+x1q)2-$Yn5)qJ4a zY}RT!yzrcHLcKH5JaS`V$BhXb!GK^yFd>)`EC>L>ieN*qBQzm2BRCM82n0e4f(xM) zVb1i83Aejzj;#f=VB0aU&C+A~wQ&RfPi(vDno&B2#j%vW7n=kjS*(hpFE7UmX-c6> z5EqGW8)**-smay>7`)xuzk=-~`DHY}%tw0s47)+U_awiBen20V#*%k;*vp5b$#67U zO(!#QidFHCS$N(>JZkjw96b1{;V~#D+|$eTSTFBky!8Laexak-#NF6bt(J?&BvDEy zy<7|qxrm3=8SW`F?;&Y4QAD;~NCe>ci!+_?LH+F4T&gkBlZW z)tC~3XIxE-)WHwiVat}*#|#Vy@lDMsI6l8E4F@A`&@(%6pND4s4f1Dobi$ikDgygiZ z%G5KykfQjD1$EEzkeT&pJB;_Y{Q>^;sH^>pd&e#Fu^!sbJUG`cbqur2Xt~{^-w}jL zwBTdB<#b$3_}H}i{P;ugyvelIgiZwsT?>eXu=ApOzbfx}56%?abKzeTNfM!NQ7!kq=oS(v^x<8oQvzvVJmrpZpQZuX&cWX3K37hCC9X8-^I diff --git a/database/server.go b/database/server.go index 48bbbc6..d2502f1 100644 --- a/database/server.go +++ b/database/server.go @@ -71,7 +71,29 @@ func main() { return c.String(http.StatusInternalServerError, "error runing the python scrips") } - return c.String(http.StatusOK, string(output)) + // Get list of images from the 'recognised_faces' folder + recognisedFacesPath := "../server-app/recognised_faces/" + files, err := os.ReadDir(recognisedFacesPath) + if err != nil { + return c.String(http.StatusInternalServerError, "Error reading recognised faces folder") + } + + var faceImages []string + for _, file := range files { + if !file.IsDir() { + // Optionally, read and encode image content in base64, or just send filenames + filePath := recognisedFacesPath + file.Name() + faceImages = append(faceImages, filePath) + } + } + + // Create a response containing the script output and the list of recognised faces + response := map[string]interface{}{ + "python_output": string(output), + "recognised_faces": faceImages, + } + + return c.JSON(http.StatusOK, response) }, apis.ActivityLogger(app)) return nil