@gradio/core 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/src/Blocks.svelte +17 -1
- package/dist/src/init.d.ts +1 -1
- package/dist/src/init.js +1 -1
- package/dist/src/lang/th.json +143 -0
- package/dist/src/types.d.ts +2 -0
- package/package.json +32 -32
- package/src/Blocks.svelte +19 -1
- package/src/init.ts +2 -2
- package/src/lang/th.json +143 -0
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @gradio/core
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#10500](https://github.com/gradio-app/gradio/pull/10500) [`16d419b`](https://github.com/gradio-app/gradio/commit/16d419b9f1f18ae4507d18a4739eb83ac4f3fae9) - Allow functions that solely update component properties to run in the frontend by setting `js=True`. Thanks @abidlabs!
|
|
8
|
+
|
|
9
|
+
### Dependency updates
|
|
10
|
+
|
|
11
|
+
- @gradio/upload@0.15.3
|
|
12
|
+
- @gradio/video@0.14.3
|
|
13
|
+
- @gradio/code@0.11.1
|
|
14
|
+
- @gradio/client@1.13.0
|
|
15
|
+
- @gradio/button@0.4.8
|
|
16
|
+
- @gradio/image@0.21.3
|
|
17
|
+
- @gradio/gallery@0.15.8
|
|
18
|
+
- @gradio/file@0.12.8
|
|
19
|
+
|
|
20
|
+
## 0.11.1
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- [#10679](https://github.com/gradio-app/gradio/pull/10679) [`cb3c762`](https://github.com/gradio-app/gradio/commit/cb3c76205c3fc1fae55229b5efe223c6d5c5c907) - Add Thai Translate. Thanks @haihandsome!
|
|
25
|
+
|
|
26
|
+
## 0.11.0
|
|
27
|
+
|
|
28
|
+
### Dependency updates
|
|
29
|
+
|
|
30
|
+
- @gradio/code@0.11.0
|
|
31
|
+
|
|
3
32
|
## 0.11.0
|
|
4
33
|
|
|
5
34
|
### Features
|
package/dist/src/Blocks.svelte
CHANGED
|
@@ -212,7 +212,7 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
212
212
|
event_data: dep.collects_event_data ? event_data : null,
|
|
213
213
|
trigger_id
|
|
214
214
|
};
|
|
215
|
-
if (dep.frontend_fn) {
|
|
215
|
+
if (dep.frontend_fn && typeof dep.frontend_fn !== "boolean") {
|
|
216
216
|
dep.frontend_fn(
|
|
217
217
|
payload.data.concat(
|
|
218
218
|
await Promise.all(dep.outputs.map((id) => get_data(id)))
|
|
@@ -235,6 +235,19 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
235
235
|
);
|
|
236
236
|
} else {
|
|
237
237
|
if (dep.backend_fn) {
|
|
238
|
+
if (dep.js_implementation) {
|
|
239
|
+
let js_fn = new AsyncFunction(
|
|
240
|
+
`let result = await (${dep.js_implementation})(...arguments);
|
|
241
|
+
return (!Array.isArray(result)) ? [result] : result;`
|
|
242
|
+
);
|
|
243
|
+
js_fn(...payload.data).then((js_result) => {
|
|
244
|
+
handle_update(js_result, dep_index);
|
|
245
|
+
payload.js_implementation = true;
|
|
246
|
+
}).catch((error) => {
|
|
247
|
+
console.error(error);
|
|
248
|
+
payload.js_implementation = false;
|
|
249
|
+
});
|
|
250
|
+
}
|
|
238
251
|
trigger_prediction(dep, payload);
|
|
239
252
|
}
|
|
240
253
|
}
|
|
@@ -299,6 +312,9 @@ async function trigger_api_call(dep_index, trigger_id = null, event_data = null)
|
|
|
299
312
|
}
|
|
300
313
|
submit_map.set(dep_index, submission);
|
|
301
314
|
for await (const message of submission) {
|
|
315
|
+
if (payload2.js_implementation) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
302
318
|
if (message.type === "data") {
|
|
303
319
|
handle_data(message);
|
|
304
320
|
} else if (message.type === "render") {
|
package/dist/src/init.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare const AsyncFunction: new (...args: string[]) => (...args: any[])
|
|
|
45
45
|
* @param output_length the number of outputs
|
|
46
46
|
* @returns The function, or null if the source code is invalid or missing
|
|
47
47
|
*/
|
|
48
|
-
export declare function process_frontend_fn(source: string | null | undefined |
|
|
48
|
+
export declare function process_frontend_fn(source: string | null | undefined | boolean, backend_fn: boolean, input_length: number, output_length: number): ((...args: unknown[]) => Promise<unknown[]>) | null;
|
|
49
49
|
/**
|
|
50
50
|
* `Dependency.targets` is an array of `[id, trigger]` pairs with the ids as the `fn_id`.
|
|
51
51
|
* This function take a single list of `Dependency.targets` and add those to the target_map.
|
package/dist/src/init.js
CHANGED
|
@@ -298,7 +298,7 @@ export const AsyncFunction = Object.getPrototypeOf(async function () { }).constr
|
|
|
298
298
|
* @returns The function, or null if the source code is invalid or missing
|
|
299
299
|
*/
|
|
300
300
|
export function process_frontend_fn(source, backend_fn, input_length, output_length) {
|
|
301
|
-
if (!source)
|
|
301
|
+
if (!source || source === true)
|
|
302
302
|
return null;
|
|
303
303
|
const wrap = backend_fn ? input_length === 1 : output_length === 1;
|
|
304
304
|
try {
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_name": "ภาษาไทย",
|
|
3
|
+
"3D_model": {
|
|
4
|
+
"3d_model": "โมเดล 3 มิติ",
|
|
5
|
+
"drop_to_upload": "ลากและวางไฟล์โมเดล 3 มิติ (.obj, .glb, .stl, .gltf, .splat, หรือ .ply) ที่นี่เพื่ออัปโหลด"
|
|
6
|
+
},
|
|
7
|
+
"annotated_image": {
|
|
8
|
+
"annotated_image": "รูปภาพที่มีคำอธิบาย"
|
|
9
|
+
},
|
|
10
|
+
"audio": {
|
|
11
|
+
"allow_recording_access": "กรุณาอนุญาตการเข้าถึงไมโครโฟนเพื่อบันทึกเสียง",
|
|
12
|
+
"audio": "เสียง",
|
|
13
|
+
"drop_to_upload": "ลากและวางไฟล์เสียงที่นี่เพื่ออัปโหลด",
|
|
14
|
+
"record_from_microphone": "บันทึกจากไมโครโฟน",
|
|
15
|
+
"stop_recording": "หยุดบันทึก",
|
|
16
|
+
"no_device_support": "ไม่สามารถเข้าถึงอุปกรณ์สื่อได้ โปรดตรวจสอบว่าคุณใช้งานบนโดเมนที่ปลอดภัย (https) หรือ localhost (หรือคุณได้กำหนดค่า SSL ที่ถูกต้อง) และอนุญาตให้เบราว์เซอร์เข้าถึงอุปกรณ์ของคุณ",
|
|
17
|
+
"stop": "หยุด",
|
|
18
|
+
"resume": "ทำงานต่อ",
|
|
19
|
+
"record": "บันทึก",
|
|
20
|
+
"no_microphone": "ไม่พบไมโครโฟน",
|
|
21
|
+
"pause": "หยุดชั่วคราว",
|
|
22
|
+
"play": "เล่น",
|
|
23
|
+
"waiting": "กำลังรอ"
|
|
24
|
+
},
|
|
25
|
+
"blocks": {
|
|
26
|
+
"connection_can_break": "บนมือถือ การเชื่อมต่ออาจหลุดหากแท็บนี้ไม่ได้อยู่ในโฟกัสหรืออุปกรณ์เข้าสู่โหมดพัก ส่งผลให้เสียตำแหน่งในคิว",
|
|
27
|
+
"long_requests_queue": "มีคิวคำขอรออยู่เป็นจำนวนมาก คัดลอก Space นี้เพื่อข้ามคิว",
|
|
28
|
+
"lost_connection": "การเชื่อมต่อขาดหายเนื่องจากออกจากหน้า กำลังเข้าคิวใหม่...",
|
|
29
|
+
"waiting_for_inputs": "กำลังรอไฟล์อัปโหลดเสร็จ กรุณาลองใหม่"
|
|
30
|
+
},
|
|
31
|
+
"checkbox": {
|
|
32
|
+
"checkbox": "กล่องเลือก",
|
|
33
|
+
"checkbox_group": "กลุ่มกล่องเลือก"
|
|
34
|
+
},
|
|
35
|
+
"code": {
|
|
36
|
+
"code": "โค้ด"
|
|
37
|
+
},
|
|
38
|
+
"color_picker": {
|
|
39
|
+
"color_picker": "ตัวเลือกสี"
|
|
40
|
+
},
|
|
41
|
+
"common": {
|
|
42
|
+
"built_with": "สร้างด้วย",
|
|
43
|
+
"built_with_gradio": "สร้างด้วย Gradio",
|
|
44
|
+
"clear": "ล้าง",
|
|
45
|
+
"download": "ดาวน์โหลด",
|
|
46
|
+
"edit": "แก้ไข",
|
|
47
|
+
"empty": "ว่างเปล่า",
|
|
48
|
+
"error": "ข้อผิดพลาด",
|
|
49
|
+
"hosted_on": "โฮสต์บน",
|
|
50
|
+
"loading": "กำลังโหลด",
|
|
51
|
+
"logo": "โลโก้",
|
|
52
|
+
"or": "หรือ",
|
|
53
|
+
"remove": "ลบ",
|
|
54
|
+
"settings": "การตั้งค่า",
|
|
55
|
+
"share": "แชร์",
|
|
56
|
+
"submit": "ส่ง",
|
|
57
|
+
"undo": "เลิกทำ",
|
|
58
|
+
"no_devices": "ไม่พบอุปกรณ์",
|
|
59
|
+
"language": "ภาษา",
|
|
60
|
+
"display_theme": "ธีมการแสดงผล",
|
|
61
|
+
"pwa": "โปรเกรสซีฟเว็บแอพ"
|
|
62
|
+
},
|
|
63
|
+
"dataframe": {
|
|
64
|
+
"incorrect_format": "รูปแบบไม่ถูกต้อง รองรับเฉพาะไฟล์ CSV และ TSV",
|
|
65
|
+
"new_column": "เพิ่มคอลัมน์",
|
|
66
|
+
"new_row": "เพิ่มแถวใหม่",
|
|
67
|
+
"add_row_above": "เพิ่มแถวด้านบน",
|
|
68
|
+
"add_row_below": "เพิ่มแถวด้านล่าง",
|
|
69
|
+
"delete_row": "ลบแถว",
|
|
70
|
+
"delete_column": "ลบคอลัมน์",
|
|
71
|
+
"add_column_left": "เพิ่มคอลัมน์ทางซ้าย",
|
|
72
|
+
"add_column_right": "เพิ่มคอลัมน์ทางขวา",
|
|
73
|
+
"sort_column": "เรียงลำดับคอลัมน์",
|
|
74
|
+
"sort_ascending": "เรียงจากน้อยไปมาก",
|
|
75
|
+
"sort_descending": "เรียงจากมากไปน้อย",
|
|
76
|
+
"drop_to_upload": "ลากและวางไฟล์ CSV หรือ TSV ที่นี่เพื่อนำเข้าข้อมูล"
|
|
77
|
+
},
|
|
78
|
+
"dropdown": {
|
|
79
|
+
"dropdown": "เมนูดรอปดาวน์"
|
|
80
|
+
},
|
|
81
|
+
"errors": {
|
|
82
|
+
"build_error": "เกิดข้อผิดพลาดในการสร้าง",
|
|
83
|
+
"config_error": "เกิดข้อผิดพลาดในการกำหนดค่า",
|
|
84
|
+
"contact_page_author": "โปรดติดต่อผู้ดูแลเพจเพื่อแจ้งให้ทราบ",
|
|
85
|
+
"no_app_file": "ไม่พบไฟล์แอป",
|
|
86
|
+
"runtime_error": "เกิดข้อผิดพลาดขณะทำงาน",
|
|
87
|
+
"space_not_working": "\"Space ใช้งานไม่ได้เนื่องจาก\" {0}",
|
|
88
|
+
"space_paused": "Space ถูกหยุดชั่วคราว",
|
|
89
|
+
"use_via_api": "ใช้งานผ่าน API"
|
|
90
|
+
},
|
|
91
|
+
"file": {
|
|
92
|
+
"uploading": "กำลังอัปโหลด..."
|
|
93
|
+
},
|
|
94
|
+
"highlighted_text": {
|
|
95
|
+
"highlighted_text": "ข้อความที่ถูกเน้น"
|
|
96
|
+
},
|
|
97
|
+
"image": {
|
|
98
|
+
"allow_webcam_access": "กรุณาอนุญาตการเข้าถึงเว็บแคมเพื่อบันทึกวิดีโอ",
|
|
99
|
+
"brush_color": "สีแปรง",
|
|
100
|
+
"brush_radius": "ขนาดแปรง",
|
|
101
|
+
"image": "รูปภาพ",
|
|
102
|
+
"remove_image": "ลบรูปภาพ",
|
|
103
|
+
"select_brush_color": "เลือกสีแปรง",
|
|
104
|
+
"start_drawing": "เริ่มวาด",
|
|
105
|
+
"use_brush": "ใช้แปรง",
|
|
106
|
+
"drop_to_upload": "ลากและวางไฟล์รูปภาพที่นี่เพื่ออัปโหลด"
|
|
107
|
+
},
|
|
108
|
+
"label": {
|
|
109
|
+
"label": "ป้ายกำกับ"
|
|
110
|
+
},
|
|
111
|
+
"login": {
|
|
112
|
+
"enable_cookies": "หากคุณเข้าใช้งาน HuggingFace Space ในโหมดไม่ระบุตัวตน คุณต้องเปิดใช้งานคุกกี้ของบุคคลที่สาม",
|
|
113
|
+
"incorrect_credentials": "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง",
|
|
114
|
+
"username": "ชื่อผู้ใช้",
|
|
115
|
+
"password": "รหัสผ่าน",
|
|
116
|
+
"login": "เข้าสู่ระบบ"
|
|
117
|
+
},
|
|
118
|
+
"number": {
|
|
119
|
+
"number": "ตัวเลข"
|
|
120
|
+
},
|
|
121
|
+
"plot": {
|
|
122
|
+
"plot": "กราฟ"
|
|
123
|
+
},
|
|
124
|
+
"radio": {
|
|
125
|
+
"radio": "ปุ่มตัวเลือก"
|
|
126
|
+
},
|
|
127
|
+
"slider": {
|
|
128
|
+
"slider": "แถบเลื่อน"
|
|
129
|
+
},
|
|
130
|
+
"upload_text": {
|
|
131
|
+
"click_to_upload": "คลิกเพื่ออัปโหลด",
|
|
132
|
+
"drop_audio": "ลากและวางไฟล์เสียงที่นี่",
|
|
133
|
+
"drop_csv": "ลากและวางไฟล์ CSV ที่นี่",
|
|
134
|
+
"drop_file": "ลากและวางไฟล์ที่นี่",
|
|
135
|
+
"drop_image": "ลากและวางไฟล์รูปภาพที่นี่",
|
|
136
|
+
"drop_video": "ลากและวางไฟล์วิดีโอที่นี่",
|
|
137
|
+
"drop_gallery": "ลากและวางไฟล์สื่อที่นี่",
|
|
138
|
+
"paste_clipboard": "วางจากคลิปบอร์ด"
|
|
139
|
+
},
|
|
140
|
+
"video": {
|
|
141
|
+
"drop_to_upload": "ลากและวางไฟล์วิดีโอที่นี่เพื่ออัปโหลด"
|
|
142
|
+
}
|
|
143
|
+
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface Payload {
|
|
|
39
39
|
data: unknown[];
|
|
40
40
|
event_data?: unknown | null;
|
|
41
41
|
trigger_id?: number | null;
|
|
42
|
+
js_implementation?: boolean | null;
|
|
42
43
|
}
|
|
43
44
|
/** A dependency as received from the backend */
|
|
44
45
|
export interface Dependency {
|
|
@@ -70,6 +71,7 @@ export interface Dependency {
|
|
|
70
71
|
stream_every: number;
|
|
71
72
|
like_user_message: boolean;
|
|
72
73
|
event_specific_args: string[];
|
|
74
|
+
js_implementation: string | null;
|
|
73
75
|
}
|
|
74
76
|
interface TypeDescription {
|
|
75
77
|
input_payload?: string;
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@gradio/accordion": "^0.5.8",
|
|
7
|
-
"@gradio/annotatedimage": "^0.9.8",
|
|
8
7
|
"@gradio/atoms": "^0.13.3",
|
|
9
|
-
"@gradio/audio": "^0.17.
|
|
8
|
+
"@gradio/audio": "^0.17.3",
|
|
10
9
|
"@gradio/box": "^0.2.12",
|
|
11
|
-
"@gradio/
|
|
10
|
+
"@gradio/annotatedimage": "^0.9.9",
|
|
11
|
+
"@gradio/button": "^0.4.8",
|
|
12
|
+
"@gradio/chatbot": "^0.24.2",
|
|
12
13
|
"@gradio/checkbox": "^0.4.14",
|
|
13
14
|
"@gradio/checkboxgroup": "^0.6.14",
|
|
14
|
-
"@gradio/
|
|
15
|
-
"@gradio/
|
|
16
|
-
"@gradio/code": "^0.10.18",
|
|
15
|
+
"@gradio/client": "^1.13.0",
|
|
16
|
+
"@gradio/code": "^0.11.1",
|
|
17
17
|
"@gradio/colorpicker": "^0.4.14",
|
|
18
|
-
"@gradio/
|
|
19
|
-
"@gradio/dataset": "^0.4.7",
|
|
20
|
-
"@gradio/dataframe": "^0.16.2",
|
|
18
|
+
"@gradio/dataset": "^0.4.8",
|
|
21
19
|
"@gradio/datetime": "^0.3.6",
|
|
22
|
-
"@gradio/
|
|
23
|
-
"@gradio/
|
|
24
|
-
"@gradio/
|
|
20
|
+
"@gradio/column": "^0.2.0",
|
|
21
|
+
"@gradio/downloadbutton": "^0.3.8",
|
|
22
|
+
"@gradio/dataframe": "^0.16.4",
|
|
25
23
|
"@gradio/fallback": "^0.4.14",
|
|
26
|
-
"@gradio/
|
|
24
|
+
"@gradio/file": "^0.12.8",
|
|
25
|
+
"@gradio/dropdown": "^0.9.13",
|
|
27
26
|
"@gradio/form": "^0.2.12",
|
|
28
|
-
"@gradio/
|
|
27
|
+
"@gradio/fileexplorer": "^0.5.19",
|
|
28
|
+
"@gradio/gallery": "^0.15.8",
|
|
29
29
|
"@gradio/group": "^0.2.0",
|
|
30
|
-
"@gradio/highlightedtext": "^0.8.14",
|
|
31
|
-
"@gradio/icons": "^0.10.0",
|
|
32
30
|
"@gradio/html": "^0.6.5",
|
|
33
|
-
"@gradio/
|
|
34
|
-
"@gradio/
|
|
31
|
+
"@gradio/icons": "^0.10.0",
|
|
32
|
+
"@gradio/highlightedtext": "^0.8.14",
|
|
33
|
+
"@gradio/imageeditor": "^0.12.10",
|
|
34
|
+
"@gradio/image": "^0.21.3",
|
|
35
35
|
"@gradio/json": "^0.5.14",
|
|
36
36
|
"@gradio/label": "^0.5.6",
|
|
37
37
|
"@gradio/browserstate": "^0.3.1",
|
|
38
|
-
"@gradio/model3d": "^0.14.2",
|
|
39
38
|
"@gradio/markdown": "^0.13.4",
|
|
39
|
+
"@gradio/multimodaltextbox": "^0.9.9",
|
|
40
|
+
"@gradio/model3d": "^0.14.3",
|
|
40
41
|
"@gradio/nativeplot": "^0.5.8",
|
|
41
|
-
"@gradio/multimodaltextbox": "^0.9.8",
|
|
42
|
-
"@gradio/number": "^0.5.14",
|
|
43
42
|
"@gradio/paramviewer": "^0.7.2",
|
|
43
|
+
"@gradio/plot": "^0.9.9",
|
|
44
|
+
"@gradio/number": "^0.5.14",
|
|
44
45
|
"@gradio/radio": "^0.6.14",
|
|
46
|
+
"@gradio/simpledropdown": "^0.3.14",
|
|
45
47
|
"@gradio/row": "^0.2.1",
|
|
48
|
+
"@gradio/simpleimage": "^0.8.19",
|
|
49
|
+
"@gradio/simpletextbox": "^0.3.14",
|
|
46
50
|
"@gradio/sidebar": "^0.1.5",
|
|
47
|
-
"@gradio/plot": "^0.9.9",
|
|
48
|
-
"@gradio/simpledropdown": "^0.3.14",
|
|
49
|
-
"@gradio/simpleimage": "^0.8.18",
|
|
50
51
|
"@gradio/sketchbox": "^0.6.0",
|
|
51
|
-
"@gradio/simpletextbox": "^0.3.14",
|
|
52
52
|
"@gradio/slider": "^0.6.2",
|
|
53
|
-
"@gradio/statustracker": "^0.10.4",
|
|
54
53
|
"@gradio/state": "^0.1.2",
|
|
54
|
+
"@gradio/statustracker": "^0.10.4",
|
|
55
55
|
"@gradio/tabitem": "^0.4.2",
|
|
56
56
|
"@gradio/tabs": "^0.4.2",
|
|
57
|
-
"@gradio/textbox": "^0.10.4",
|
|
58
57
|
"@gradio/theme": "^0.4.0",
|
|
59
|
-
"@gradio/upload": "^0.15.2",
|
|
60
58
|
"@gradio/timer": "^0.4.4",
|
|
61
|
-
"@gradio/
|
|
59
|
+
"@gradio/upload": "^0.15.3",
|
|
60
|
+
"@gradio/textbox": "^0.10.4",
|
|
61
|
+
"@gradio/uploadbutton": "^0.8.8",
|
|
62
62
|
"@gradio/utils": "^0.10.1",
|
|
63
|
-
"@gradio/
|
|
64
|
-
"@gradio/
|
|
63
|
+
"@gradio/video": "^0.14.3",
|
|
64
|
+
"@gradio/wasm": "^0.17.3"
|
|
65
65
|
},
|
|
66
66
|
"msw": {
|
|
67
67
|
"workerDirectory": "public"
|
package/src/Blocks.svelte
CHANGED
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
trigger_id: trigger_id
|
|
290
290
|
};
|
|
291
291
|
|
|
292
|
-
if (dep.frontend_fn) {
|
|
292
|
+
if (dep.frontend_fn && typeof dep.frontend_fn !== "boolean") {
|
|
293
293
|
dep
|
|
294
294
|
.frontend_fn(
|
|
295
295
|
payload.data.concat(
|
|
@@ -314,6 +314,21 @@
|
|
|
314
314
|
);
|
|
315
315
|
} else {
|
|
316
316
|
if (dep.backend_fn) {
|
|
317
|
+
if (dep.js_implementation) {
|
|
318
|
+
let js_fn = new AsyncFunction(
|
|
319
|
+
`let result = await (${dep.js_implementation})(...arguments);
|
|
320
|
+
return (!Array.isArray(result)) ? [result] : result;`
|
|
321
|
+
);
|
|
322
|
+
js_fn(...payload.data)
|
|
323
|
+
.then((js_result) => {
|
|
324
|
+
handle_update(js_result, dep_index);
|
|
325
|
+
payload.js_implementation = true;
|
|
326
|
+
})
|
|
327
|
+
.catch((error) => {
|
|
328
|
+
console.error(error);
|
|
329
|
+
payload.js_implementation = false;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
317
332
|
trigger_prediction(dep, payload);
|
|
318
333
|
}
|
|
319
334
|
}
|
|
@@ -391,6 +406,9 @@
|
|
|
391
406
|
submit_map.set(dep_index, submission);
|
|
392
407
|
|
|
393
408
|
for await (const message of submission) {
|
|
409
|
+
if (payload.js_implementation) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
394
412
|
if (message.type === "data") {
|
|
395
413
|
handle_data(message);
|
|
396
414
|
} else if (message.type === "render") {
|
package/src/init.ts
CHANGED
|
@@ -478,12 +478,12 @@ export const AsyncFunction: new (
|
|
|
478
478
|
* @returns The function, or null if the source code is invalid or missing
|
|
479
479
|
*/
|
|
480
480
|
export function process_frontend_fn(
|
|
481
|
-
source: string | null | undefined |
|
|
481
|
+
source: string | null | undefined | boolean,
|
|
482
482
|
backend_fn: boolean,
|
|
483
483
|
input_length: number,
|
|
484
484
|
output_length: number
|
|
485
485
|
): ((...args: unknown[]) => Promise<unknown[]>) | null {
|
|
486
|
-
if (!source) return null;
|
|
486
|
+
if (!source || source === true) return null;
|
|
487
487
|
|
|
488
488
|
const wrap = backend_fn ? input_length === 1 : output_length === 1;
|
|
489
489
|
try {
|
package/src/lang/th.json
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_name": "ภาษาไทย",
|
|
3
|
+
"3D_model": {
|
|
4
|
+
"3d_model": "โมเดล 3 มิติ",
|
|
5
|
+
"drop_to_upload": "ลากและวางไฟล์โมเดล 3 มิติ (.obj, .glb, .stl, .gltf, .splat, หรือ .ply) ที่นี่เพื่ออัปโหลด"
|
|
6
|
+
},
|
|
7
|
+
"annotated_image": {
|
|
8
|
+
"annotated_image": "รูปภาพที่มีคำอธิบาย"
|
|
9
|
+
},
|
|
10
|
+
"audio": {
|
|
11
|
+
"allow_recording_access": "กรุณาอนุญาตการเข้าถึงไมโครโฟนเพื่อบันทึกเสียง",
|
|
12
|
+
"audio": "เสียง",
|
|
13
|
+
"drop_to_upload": "ลากและวางไฟล์เสียงที่นี่เพื่ออัปโหลด",
|
|
14
|
+
"record_from_microphone": "บันทึกจากไมโครโฟน",
|
|
15
|
+
"stop_recording": "หยุดบันทึก",
|
|
16
|
+
"no_device_support": "ไม่สามารถเข้าถึงอุปกรณ์สื่อได้ โปรดตรวจสอบว่าคุณใช้งานบนโดเมนที่ปลอดภัย (https) หรือ localhost (หรือคุณได้กำหนดค่า SSL ที่ถูกต้อง) และอนุญาตให้เบราว์เซอร์เข้าถึงอุปกรณ์ของคุณ",
|
|
17
|
+
"stop": "หยุด",
|
|
18
|
+
"resume": "ทำงานต่อ",
|
|
19
|
+
"record": "บันทึก",
|
|
20
|
+
"no_microphone": "ไม่พบไมโครโฟน",
|
|
21
|
+
"pause": "หยุดชั่วคราว",
|
|
22
|
+
"play": "เล่น",
|
|
23
|
+
"waiting": "กำลังรอ"
|
|
24
|
+
},
|
|
25
|
+
"blocks": {
|
|
26
|
+
"connection_can_break": "บนมือถือ การเชื่อมต่ออาจหลุดหากแท็บนี้ไม่ได้อยู่ในโฟกัสหรืออุปกรณ์เข้าสู่โหมดพัก ส่งผลให้เสียตำแหน่งในคิว",
|
|
27
|
+
"long_requests_queue": "มีคิวคำขอรออยู่เป็นจำนวนมาก คัดลอก Space นี้เพื่อข้ามคิว",
|
|
28
|
+
"lost_connection": "การเชื่อมต่อขาดหายเนื่องจากออกจากหน้า กำลังเข้าคิวใหม่...",
|
|
29
|
+
"waiting_for_inputs": "กำลังรอไฟล์อัปโหลดเสร็จ กรุณาลองใหม่"
|
|
30
|
+
},
|
|
31
|
+
"checkbox": {
|
|
32
|
+
"checkbox": "กล่องเลือก",
|
|
33
|
+
"checkbox_group": "กลุ่มกล่องเลือก"
|
|
34
|
+
},
|
|
35
|
+
"code": {
|
|
36
|
+
"code": "โค้ด"
|
|
37
|
+
},
|
|
38
|
+
"color_picker": {
|
|
39
|
+
"color_picker": "ตัวเลือกสี"
|
|
40
|
+
},
|
|
41
|
+
"common": {
|
|
42
|
+
"built_with": "สร้างด้วย",
|
|
43
|
+
"built_with_gradio": "สร้างด้วย Gradio",
|
|
44
|
+
"clear": "ล้าง",
|
|
45
|
+
"download": "ดาวน์โหลด",
|
|
46
|
+
"edit": "แก้ไข",
|
|
47
|
+
"empty": "ว่างเปล่า",
|
|
48
|
+
"error": "ข้อผิดพลาด",
|
|
49
|
+
"hosted_on": "โฮสต์บน",
|
|
50
|
+
"loading": "กำลังโหลด",
|
|
51
|
+
"logo": "โลโก้",
|
|
52
|
+
"or": "หรือ",
|
|
53
|
+
"remove": "ลบ",
|
|
54
|
+
"settings": "การตั้งค่า",
|
|
55
|
+
"share": "แชร์",
|
|
56
|
+
"submit": "ส่ง",
|
|
57
|
+
"undo": "เลิกทำ",
|
|
58
|
+
"no_devices": "ไม่พบอุปกรณ์",
|
|
59
|
+
"language": "ภาษา",
|
|
60
|
+
"display_theme": "ธีมการแสดงผล",
|
|
61
|
+
"pwa": "โปรเกรสซีฟเว็บแอพ"
|
|
62
|
+
},
|
|
63
|
+
"dataframe": {
|
|
64
|
+
"incorrect_format": "รูปแบบไม่ถูกต้อง รองรับเฉพาะไฟล์ CSV และ TSV",
|
|
65
|
+
"new_column": "เพิ่มคอลัมน์",
|
|
66
|
+
"new_row": "เพิ่มแถวใหม่",
|
|
67
|
+
"add_row_above": "เพิ่มแถวด้านบน",
|
|
68
|
+
"add_row_below": "เพิ่มแถวด้านล่าง",
|
|
69
|
+
"delete_row": "ลบแถว",
|
|
70
|
+
"delete_column": "ลบคอลัมน์",
|
|
71
|
+
"add_column_left": "เพิ่มคอลัมน์ทางซ้าย",
|
|
72
|
+
"add_column_right": "เพิ่มคอลัมน์ทางขวา",
|
|
73
|
+
"sort_column": "เรียงลำดับคอลัมน์",
|
|
74
|
+
"sort_ascending": "เรียงจากน้อยไปมาก",
|
|
75
|
+
"sort_descending": "เรียงจากมากไปน้อย",
|
|
76
|
+
"drop_to_upload": "ลากและวางไฟล์ CSV หรือ TSV ที่นี่เพื่อนำเข้าข้อมูล"
|
|
77
|
+
},
|
|
78
|
+
"dropdown": {
|
|
79
|
+
"dropdown": "เมนูดรอปดาวน์"
|
|
80
|
+
},
|
|
81
|
+
"errors": {
|
|
82
|
+
"build_error": "เกิดข้อผิดพลาดในการสร้าง",
|
|
83
|
+
"config_error": "เกิดข้อผิดพลาดในการกำหนดค่า",
|
|
84
|
+
"contact_page_author": "โปรดติดต่อผู้ดูแลเพจเพื่อแจ้งให้ทราบ",
|
|
85
|
+
"no_app_file": "ไม่พบไฟล์แอป",
|
|
86
|
+
"runtime_error": "เกิดข้อผิดพลาดขณะทำงาน",
|
|
87
|
+
"space_not_working": "\"Space ใช้งานไม่ได้เนื่องจาก\" {0}",
|
|
88
|
+
"space_paused": "Space ถูกหยุดชั่วคราว",
|
|
89
|
+
"use_via_api": "ใช้งานผ่าน API"
|
|
90
|
+
},
|
|
91
|
+
"file": {
|
|
92
|
+
"uploading": "กำลังอัปโหลด..."
|
|
93
|
+
},
|
|
94
|
+
"highlighted_text": {
|
|
95
|
+
"highlighted_text": "ข้อความที่ถูกเน้น"
|
|
96
|
+
},
|
|
97
|
+
"image": {
|
|
98
|
+
"allow_webcam_access": "กรุณาอนุญาตการเข้าถึงเว็บแคมเพื่อบันทึกวิดีโอ",
|
|
99
|
+
"brush_color": "สีแปรง",
|
|
100
|
+
"brush_radius": "ขนาดแปรง",
|
|
101
|
+
"image": "รูปภาพ",
|
|
102
|
+
"remove_image": "ลบรูปภาพ",
|
|
103
|
+
"select_brush_color": "เลือกสีแปรง",
|
|
104
|
+
"start_drawing": "เริ่มวาด",
|
|
105
|
+
"use_brush": "ใช้แปรง",
|
|
106
|
+
"drop_to_upload": "ลากและวางไฟล์รูปภาพที่นี่เพื่ออัปโหลด"
|
|
107
|
+
},
|
|
108
|
+
"label": {
|
|
109
|
+
"label": "ป้ายกำกับ"
|
|
110
|
+
},
|
|
111
|
+
"login": {
|
|
112
|
+
"enable_cookies": "หากคุณเข้าใช้งาน HuggingFace Space ในโหมดไม่ระบุตัวตน คุณต้องเปิดใช้งานคุกกี้ของบุคคลที่สาม",
|
|
113
|
+
"incorrect_credentials": "ชื่อผู้ใช้หรือรหัสผ่านไม่ถูกต้อง",
|
|
114
|
+
"username": "ชื่อผู้ใช้",
|
|
115
|
+
"password": "รหัสผ่าน",
|
|
116
|
+
"login": "เข้าสู่ระบบ"
|
|
117
|
+
},
|
|
118
|
+
"number": {
|
|
119
|
+
"number": "ตัวเลข"
|
|
120
|
+
},
|
|
121
|
+
"plot": {
|
|
122
|
+
"plot": "กราฟ"
|
|
123
|
+
},
|
|
124
|
+
"radio": {
|
|
125
|
+
"radio": "ปุ่มตัวเลือก"
|
|
126
|
+
},
|
|
127
|
+
"slider": {
|
|
128
|
+
"slider": "แถบเลื่อน"
|
|
129
|
+
},
|
|
130
|
+
"upload_text": {
|
|
131
|
+
"click_to_upload": "คลิกเพื่ออัปโหลด",
|
|
132
|
+
"drop_audio": "ลากและวางไฟล์เสียงที่นี่",
|
|
133
|
+
"drop_csv": "ลากและวางไฟล์ CSV ที่นี่",
|
|
134
|
+
"drop_file": "ลากและวางไฟล์ที่นี่",
|
|
135
|
+
"drop_image": "ลากและวางไฟล์รูปภาพที่นี่",
|
|
136
|
+
"drop_video": "ลากและวางไฟล์วิดีโอที่นี่",
|
|
137
|
+
"drop_gallery": "ลากและวางไฟล์สื่อที่นี่",
|
|
138
|
+
"paste_clipboard": "วางจากคลิปบอร์ด"
|
|
139
|
+
},
|
|
140
|
+
"video": {
|
|
141
|
+
"drop_to_upload": "ลากและวางไฟล์วิดีโอที่นี่เพื่ออัปโหลด"
|
|
142
|
+
}
|
|
143
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface Payload {
|
|
|
43
43
|
data: unknown[];
|
|
44
44
|
event_data?: unknown | null;
|
|
45
45
|
trigger_id?: number | null;
|
|
46
|
+
js_implementation?: boolean | null;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/** A dependency as received from the backend */
|
|
@@ -75,6 +76,7 @@ export interface Dependency {
|
|
|
75
76
|
stream_every: number;
|
|
76
77
|
like_user_message: boolean;
|
|
77
78
|
event_specific_args: string[];
|
|
79
|
+
js_implementation: string | null;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
interface TypeDescription {
|