MingDoan commited on
Commit
6436537
·
1 Parent(s): e2c169e

fix: HF Space Config

Browse files
Files changed (2) hide show
  1. DOCS.md +131 -0
  2. README.md +1 -136
DOCS.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div style="width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center">
2
+ <img style="width:80px"
3
+ src="https://seeklogo.com/images/G/google-developers-logo-F8BF3155AC-seeklogo.com.png" alt="logo"/>
4
+ </div>
5
+ <h3 style="text-align:center">Google Developer Student Clubs - FPT University Da Nang</h3>
6
+
7
+ # AI Services
8
+
9
+ ![version](https://img.shields.io/badge/version-0.1.1-green)
10
+ ![release](https://img.shields.io/badge/release-0.1.0-blue)
11
+
12
+ ## ✨ Available Services
13
+
14
+ ## ⏩ Forwarding Server
15
+
16
+ The forwarding server help adding children server for processing. The parent server acts as a controller for load balancing.
17
+
18
+ ```bash
19
+ # Specifying forwarding server by query params `fw`
20
+ curl --location 'https://{api-endpoint}/?fw=0' --request 'POST'
21
+
22
+ # Auto forwarding server. The parent server will controll loading balance among registered servers.
23
+ curl --location 'https://{api-endpoint}/?fw=auto' --request 'POST'
24
+ ```
25
+
26
+ - Get all registered forwarding servers.
27
+
28
+ ```bash
29
+ curl --location 'https://{domain}/service/fw/' --request 'GET'
30
+ ```
31
+
32
+ - Register forwarding server.
33
+
34
+ ```bash
35
+ curl --location 'https://{domain}/service/fw/' --request 'POST' --data '{"url":"{children-base-domain}"}'
36
+ ```
37
+
38
+ - Delete forwarding server.
39
+
40
+ ```bash
41
+ curl --location 'https://{domain}/service/fw/' --request 'DELETE' --data '{"index":0}'
42
+ ```
43
+
44
+ ### Server Health Checker
45
+
46
+ ```bash
47
+ curl --location '{children-base-domain}/health'
48
+ ```
49
+
50
+ This route checks the health status of children server. The children is considered as good health when it return anything with status 200.
51
+
52
+ ### Children Server Endpoint Request & Response
53
+
54
+ - `/api/rembg/`
55
+
56
+ ```json
57
+ // Request. Form-data
58
+ {
59
+ "image": "<image-data>"
60
+ }
61
+
62
+ // Response. JSON
63
+ {
64
+ "data": {
65
+ "image": "<static-access-url>"
66
+ }
67
+ }
68
+ ```
69
+
70
+ - `/api/fd/`
71
+
72
+ ```json
73
+ // Request. Form-data
74
+ {
75
+ "image": "<image-data"
76
+ }
77
+
78
+ // Response. JSON
79
+ {
80
+ "data": {
81
+ "faces": []
82
+ }
83
+ }
84
+ ```
85
+
86
+ - `/api/chats/`
87
+
88
+ ```json
89
+ // Request. JSON
90
+ {
91
+ "prompt": "A Prompt from user"
92
+ }
93
+
94
+ // Response. JSON
95
+ {
96
+ "data": {
97
+ "message": "A Message from AI"
98
+ }
99
+ }
100
+ ```
101
+
102
+ - `/api/chats/:id`
103
+
104
+ ```json
105
+ // Request. JSON
106
+ {
107
+ "prompt": "A Prompt from user",
108
+ "conversation": [
109
+ {
110
+ "role": "user",
111
+ "content": "Message A"
112
+ },
113
+ {
114
+ "role": "assistant",
115
+ "content": "Message B"
116
+ }
117
+ ]
118
+ }
119
+
120
+ // Response. JSON
121
+ {
122
+ "data": {
123
+ "message": "A Message from AI"
124
+ }
125
+ }
126
+ ```
127
+
128
+ ## 😊 Contributors
129
+
130
+ - GDSC-FPTU [[gdsc-fptu](https://github.com/gdsc-fptu)]
131
+ - Đoàn Quang Minh [[Ming-doan](https://github.com/Ming-doan)]
README.md CHANGED
@@ -1,144 +1,9 @@
1
- <div style="width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center">
2
- <img style="width:80px"
3
- src="https://seeklogo.com/images/G/google-developers-logo-F8BF3155AC-seeklogo.com.png" alt="logo"/>
4
- </div>
5
- <h3 style="text-align:center">Google Developer Student Clubs - FPT University Da Nang</h3>
6
-
7
- # AI Services
8
-
9
- ![version](https://img.shields.io/badge/version-0.1.1-green)
10
- ![release](https://img.shields.io/badge/release-0.1.0-blue)
11
-
12
- ## ✨ Available Services
13
-
14
- ## ⏩ Forwarding Server
15
-
16
- The forwarding server help adding children server for processing. The parent server acts as a controller for load balancing.
17
-
18
- ```bash
19
- # Specifying forwarding server by query params `fw`
20
- curl --location 'https://{api-endpoint}/?fw=0' --request 'POST'
21
-
22
- # Auto forwarding server. The parent server will controll loading balance among registered servers.
23
- curl --location 'https://{api-endpoint}/?fw=auto' --request 'POST'
24
- ```
25
-
26
- - Get all registered forwarding servers.
27
-
28
- ```bash
29
- curl --location 'https://{domain}/service/fw/' --request 'GET'
30
- ```
31
-
32
- - Register forwarding server.
33
-
34
- ```bash
35
- curl --location 'https://{domain}/service/fw/' --request 'POST' --data '{"url":"{children-base-domain}"}'
36
- ```
37
-
38
- - Delete forwarding server.
39
-
40
- ```bash
41
- curl --location 'https://{domain}/service/fw/' --request 'DELETE' --data '{"index":0}'
42
- ```
43
-
44
- ### Server Health Checker
45
-
46
- ```bash
47
- curl --location '{children-base-domain}/health'
48
- ```
49
-
50
- This route checks the health status of children server. The children is considered as good health when it return anything with status 200.
51
-
52
- ### Children Server Endpoint Request & Response
53
-
54
- - `/api/rembg/`
55
-
56
- ```json
57
- // Request. Form-data
58
- {
59
- "image": "<image-data>"
60
- }
61
-
62
- // Response. JSON
63
- {
64
- "data": {
65
- "image": "<static-access-url>"
66
- }
67
- }
68
- ```
69
-
70
- - `/api/fd/`
71
-
72
- ```json
73
- // Request. Form-data
74
- {
75
- "image": "<image-data"
76
- }
77
-
78
- // Response. JSON
79
- {
80
- "data": {
81
- "faces": []
82
- }
83
- }
84
- ```
85
-
86
- - `/api/chats/`
87
-
88
- ```json
89
- // Request. JSON
90
- {
91
- "prompt": "A Prompt from user"
92
- }
93
-
94
- // Response. JSON
95
- {
96
- "data": {
97
- "message": "A Message from AI"
98
- }
99
- }
100
- ```
101
-
102
- - `/api/chats/:id`
103
-
104
- ```json
105
- // Request. JSON
106
- {
107
- "prompt": "A Prompt from user",
108
- "conversation": [
109
- {
110
- "role": "user",
111
- "content": "Message A"
112
- },
113
- {
114
- "role": "assistant",
115
- "content": "Message B"
116
- }
117
- ]
118
- }
119
-
120
- // Response. JSON
121
- {
122
- "data": {
123
- "message": "A Message from AI"
124
- }
125
- }
126
- ```
127
-
128
- ## 😊 Contributors
129
-
130
- - GDSC-FPTU [[gdsc-fptu](https://github.com/gdsc-fptu)]
131
- - Đoàn Quang Minh [[Ming-doan](https://github.com/Ming-doan)]
132
-
133
- ## 🤗 HF Space Configs
134
-
135
  ---
136
-
137
  title: GDSC AI Service
138
  emoji: ⚡
139
  colorFrom: pink
140
  colorTo: blue
141
  sdk: static
 
142
  pinned: false
143
-
144
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
2
  title: GDSC AI Service
3
  emoji: ⚡
4
  colorFrom: pink
5
  colorTo: blue
6
  sdk: static
7
+ app_file: app.py
8
  pinned: false
 
9
  ---