-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.go
36 lines (27 loc) · 816 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"net/http"
"github.com/GuyARoss/clip-video-search/internal/engine"
"github.com/GuyARoss/clip-video-search/internal/web"
"github.com/GuyARoss/clip-video-search/pkg/inference"
"github.com/GuyARoss/clip-video-search/pkg/queue"
"github.com/GuyARoss/clip-video-search/pkg/zmqpool"
)
func main() {
q := queue.New()
pool := zmqpool.New([]string{
"tcp://localhost:5550",
"tcp://localhost:5551",
"tcp://localhost:5552",
})
server := inference.New(pool)
engine, err := engine.NewDefaultEngine(server)
if err != nil {
panic(err)
}
go queue.LongLivedIterator(q, engine)
engineController := web.NewEngineController(engine, q)
http.HandleFunc("/search", engineController.TopNFromText)
http.HandleFunc("/insert", engineController.Insert)
http.ListenAndServe(":3000", nil)
}