abidlabs HF staff commited on
Commit
fa03378
1 Parent(s): cd2e3a2

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -13,4 +13,4 @@ RUN pip install --no-cache-dir -r requirements.txt
13
 
14
  ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces
15
 
16
- CMD ["python", "app.py"]
 
13
 
14
  ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces
15
 
16
+ CMD ["python", "space.py"]
README.md CHANGED
@@ -1,9 +1,9 @@
1
 
2
  ---
3
  tags: [gradio-custom-component,machine learning,reproducibility,visualization,gradio,gradio-template-SimpleTextbox]
4
- title: gradio_rich_textbox V0.3.0
5
- colorFrom: pink
6
- colorTo: pink
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
 
1
 
2
  ---
3
  tags: [gradio-custom-component,machine learning,reproducibility,visualization,gradio,gradio-template-SimpleTextbox]
4
+ title: gradio_rich_textbox V0.4.2
5
+ colorFrom: indigo
6
+ colorTo: purple
7
  sdk: docker
8
  pinned: false
9
  license: apache-2.0
requirements.txt CHANGED
@@ -1 +1 @@
1
- gradio_rich_textbox-0.3.0-py3-none-any.whl
 
1
+ gradio_rich_textbox==0.4.0
src/backend/gradio_rich_textbox/richtextbox.pyi CHANGED
@@ -130,7 +130,7 @@ class RichTextbox(FormComponent):
130
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
131
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
132
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
133
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
134
  trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
135
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
136
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
@@ -172,7 +172,7 @@ class RichTextbox(FormComponent):
172
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
173
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
174
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
175
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
176
  trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
177
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
178
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
@@ -214,7 +214,7 @@ class RichTextbox(FormComponent):
214
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
215
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
216
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
217
- every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
218
  trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
219
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
220
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
 
130
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
131
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
132
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
133
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
134
  trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
135
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
136
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
 
172
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
173
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
174
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
175
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
176
  trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
177
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
178
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
 
214
  preprocess: If False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
215
  postprocess: If False, will not run postprocessing of component data before returning 'fn' output to the browser.
216
  cancels: A list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
217
+ every: Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds.
218
  trigger_mode: If "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` event) would allow a second submission after the pending event is complete.
219
  js: Optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
220
  concurrency_limit: If set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
src/backend/gradio_rich_textbox/templates/component/index.js CHANGED
@@ -2190,12 +2190,8 @@ function vn(n) {
2190
  return {
2191
  c() {
2192
  _ && _.c(), e = tt(), t = et("label"), ve(l.$$.fragment), s = tt(), i = et("div"), c.c(), O(i, "data-testid", "textbox"), O(i, "contenteditable", "true"), O(i, "class", "text-container svelte-15aeqxz"), O(i, "role", "textbox"), O(i, "tabindex", "0"), O(i, "dir", o = /*rtl*/
2193
- n[11] ? "rtl" : "ltr"), ge(
2194
- i,
2195
- "disabled",
2196
- /*mode*/
2197
- n[10] === "static"
2198
- ), O(t, "class", "svelte-15aeqxz"), ge(t, "container", yn);
2199
  },
2200
  m(d, y) {
2201
  _ && _.m(d, y), ie(d, e, y), ie(d, t, y), ye(l, t, null), $e(t, s), $e(t, i), c.m(i, null), n[19](i), f = !0, a || (r = [
@@ -2231,13 +2227,9 @@ function vn(n) {
2231
  d[6]), y & /*$$scope, label*/
2232
  2097156 && (v.$$scope = { dirty: y, ctx: d }), l.$set(v), b === (b = u(d)) && c ? c.p(d, y) : (c.d(1), c = b(d), c && (c.c(), c.m(i, null))), (!f || y & /*rtl*/
2233
  2048 && o !== (o = /*rtl*/
2234
- d[11] ? "rtl" : "ltr")) && O(i, "dir", o), (!f || y & /*mode*/
2235
- 1024) && ge(
2236
- i,
2237
- "disabled",
2238
- /*mode*/
2239
- d[10] === "static"
2240
- );
2241
  },
2242
  i(d) {
2243
  f || (K(_), K(l.$$.fragment, d), f = !0);
@@ -2298,7 +2290,7 @@ function kn(n) {
2298
  128 && (i.scale = /*scale*/
2299
  l[7]), s & /*min_width*/
2300
  256 && (i.min_width = /*min_width*/
2301
- l[8]), s & /*$$scope, rtl, el, mode, value, is_being_edited, _value, show_label, label, gradio, loading_status*/
2302
  2129479 && (i.$$scope = { dirty: s, ctx: l }), e.$set(i);
2303
  },
2304
  i(l) {
@@ -2314,7 +2306,7 @@ function kn(n) {
2314
  }
2315
  const yn = !0;
2316
  function Tn(n, e, t) {
2317
- let { gradio: l } = e, { label: s = "Textbox" } = e, { elem_id: i = "" } = e, { elem_classes: o = [] } = e, { visible: f = !0 } = e, { value: a = "" } = e, { show_label: r } = e, { scale: _ = null } = e, { min_width: u = void 0 } = e, { loading_status: b = void 0 } = e, { value_is_output: c = !1 } = e, { mode: d } = e, { rtl: y = !1 } = e, v;
2318
  function F() {
2319
  l.dispatch("change"), c || l.dispatch("input");
2320
  }
@@ -2323,10 +2315,10 @@ function Tn(n, e, t) {
2323
  }
2324
  let m = !1, z = "";
2325
  async function h() {
2326
- await he(), d !== "static" && (t(0, a = v.innerText), t(13, m = !1), t(12, v.innerText = "", v));
2327
  }
2328
  async function $() {
2329
- if (await he(), d === "static") {
2330
  v.blur();
2331
  return;
2332
  }
@@ -2338,7 +2330,7 @@ function Tn(n, e, t) {
2338
  });
2339
  }
2340
  return n.$$set = (k) => {
2341
- "gradio" in k && t(1, l = k.gradio), "label" in k && t(2, s = k.label), "elem_id" in k && t(3, i = k.elem_id), "elem_classes" in k && t(4, o = k.elem_classes), "visible" in k && t(5, f = k.visible), "value" in k && t(0, a = k.value), "show_label" in k && t(6, r = k.show_label), "scale" in k && t(7, _ = k.scale), "min_width" in k && t(8, u = k.min_width), "loading_status" in k && t(9, b = k.loading_status), "value_is_output" in k && t(18, c = k.value_is_output), "mode" in k && t(10, d = k.mode), "rtl" in k && t(11, y = k.rtl);
2342
  }, n.$$.update = () => {
2343
  n.$$.dirty & /*value*/
2344
  1 && a === null && t(0, a = ""), n.$$.dirty & /*value*/
@@ -2381,7 +2373,7 @@ class zn extends fn {
2381
  min_width: 8,
2382
  loading_status: 9,
2383
  value_is_output: 18,
2384
- mode: 10,
2385
  rtl: 11
2386
  });
2387
  }
@@ -2451,11 +2443,11 @@ class zn extends fn {
2451
  set value_is_output(e) {
2452
  this.$$set({ value_is_output: e }), E();
2453
  }
2454
- get mode() {
2455
  return this.$$.ctx[10];
2456
  }
2457
- set mode(e) {
2458
- this.$$set({ mode: e }), E();
2459
  }
2460
  get rtl() {
2461
  return this.$$.ctx[11];
 
2190
  return {
2191
  c() {
2192
  _ && _.c(), e = tt(), t = et("label"), ve(l.$$.fragment), s = tt(), i = et("div"), c.c(), O(i, "data-testid", "textbox"), O(i, "contenteditable", "true"), O(i, "class", "text-container svelte-15aeqxz"), O(i, "role", "textbox"), O(i, "tabindex", "0"), O(i, "dir", o = /*rtl*/
2193
+ n[11] ? "rtl" : "ltr"), ge(i, "disabled", !/*interactive*/
2194
+ n[10]), O(t, "class", "svelte-15aeqxz"), ge(t, "container", yn);
 
 
 
 
2195
  },
2196
  m(d, y) {
2197
  _ && _.m(d, y), ie(d, e, y), ie(d, t, y), ye(l, t, null), $e(t, s), $e(t, i), c.m(i, null), n[19](i), f = !0, a || (r = [
 
2227
  d[6]), y & /*$$scope, label*/
2228
  2097156 && (v.$$scope = { dirty: y, ctx: d }), l.$set(v), b === (b = u(d)) && c ? c.p(d, y) : (c.d(1), c = b(d), c && (c.c(), c.m(i, null))), (!f || y & /*rtl*/
2229
  2048 && o !== (o = /*rtl*/
2230
+ d[11] ? "rtl" : "ltr")) && O(i, "dir", o), (!f || y & /*interactive*/
2231
+ 1024) && ge(i, "disabled", !/*interactive*/
2232
+ d[10]);
 
 
 
 
2233
  },
2234
  i(d) {
2235
  f || (K(_), K(l.$$.fragment, d), f = !0);
 
2290
  128 && (i.scale = /*scale*/
2291
  l[7]), s & /*min_width*/
2292
  256 && (i.min_width = /*min_width*/
2293
+ l[8]), s & /*$$scope, rtl, el, interactive, value, is_being_edited, _value, show_label, label, gradio, loading_status*/
2294
  2129479 && (i.$$scope = { dirty: s, ctx: l }), e.$set(i);
2295
  },
2296
  i(l) {
 
2306
  }
2307
  const yn = !0;
2308
  function Tn(n, e, t) {
2309
+ let { gradio: l } = e, { label: s = "Textbox" } = e, { elem_id: i = "" } = e, { elem_classes: o = [] } = e, { visible: f = !0 } = e, { value: a = "" } = e, { show_label: r } = e, { scale: _ = null } = e, { min_width: u = void 0 } = e, { loading_status: b = void 0 } = e, { value_is_output: c = !1 } = e, { interactive: d } = e, { rtl: y = !1 } = e, v;
2310
  function F() {
2311
  l.dispatch("change"), c || l.dispatch("input");
2312
  }
 
2315
  }
2316
  let m = !1, z = "";
2317
  async function h() {
2318
+ await he(), d && (t(0, a = v.innerText), t(13, m = !1), t(12, v.innerText = "", v));
2319
  }
2320
  async function $() {
2321
+ if (await he(), !d) {
2322
  v.blur();
2323
  return;
2324
  }
 
2330
  });
2331
  }
2332
  return n.$$set = (k) => {
2333
+ "gradio" in k && t(1, l = k.gradio), "label" in k && t(2, s = k.label), "elem_id" in k && t(3, i = k.elem_id), "elem_classes" in k && t(4, o = k.elem_classes), "visible" in k && t(5, f = k.visible), "value" in k && t(0, a = k.value), "show_label" in k && t(6, r = k.show_label), "scale" in k && t(7, _ = k.scale), "min_width" in k && t(8, u = k.min_width), "loading_status" in k && t(9, b = k.loading_status), "value_is_output" in k && t(18, c = k.value_is_output), "interactive" in k && t(10, d = k.interactive), "rtl" in k && t(11, y = k.rtl);
2334
  }, n.$$.update = () => {
2335
  n.$$.dirty & /*value*/
2336
  1 && a === null && t(0, a = ""), n.$$.dirty & /*value*/
 
2373
  min_width: 8,
2374
  loading_status: 9,
2375
  value_is_output: 18,
2376
+ interactive: 10,
2377
  rtl: 11
2378
  });
2379
  }
 
2443
  set value_is_output(e) {
2444
  this.$$set({ value_is_output: e }), E();
2445
  }
2446
+ get interactive() {
2447
  return this.$$.ctx[10];
2448
  }
2449
+ set interactive(e) {
2450
+ this.$$set({ interactive: e }), E();
2451
  }
2452
  get rtl() {
2453
  return this.$$.ctx[11];
src/frontend/Index.svelte CHANGED
@@ -24,7 +24,7 @@
24
  export let min_width: number | undefined = undefined;
25
  export let loading_status: LoadingStatus | undefined = undefined;
26
  export let value_is_output = false;
27
- export let mode: "static" | "interactive";
28
  export let rtl = false;
29
 
30
  let el: HTMLDivElement;
@@ -53,7 +53,7 @@
53
 
54
  async function handle_blur(): Promise<void> {
55
  await tick();
56
- if (mode === "static") {
57
  return;
58
  }
59
  value = el.innerText
@@ -63,7 +63,7 @@
63
 
64
  async function handle_focus(): Promise<void> {
65
  await tick();
66
- if (mode === "static") {
67
  el.blur();
68
  return;
69
  }
@@ -101,7 +101,7 @@
101
  data-testid="textbox"
102
  contenteditable=true
103
  class="text-container"
104
- class:disabled={mode === "static"}
105
  bind:this={el}
106
  on:keypress={handle_keypress}
107
  on:blur={handle_blur}
 
24
  export let min_width: number | undefined = undefined;
25
  export let loading_status: LoadingStatus | undefined = undefined;
26
  export let value_is_output = false;
27
+ export let interactive: boolean;
28
  export let rtl = false;
29
 
30
  let el: HTMLDivElement;
 
53
 
54
  async function handle_blur(): Promise<void> {
55
  await tick();
56
+ if (!interactive) {
57
  return;
58
  }
59
  value = el.innerText
 
63
 
64
  async function handle_focus(): Promise<void> {
65
  await tick();
66
+ if (!interactive) {
67
  el.blur();
68
  return;
69
  }
 
101
  data-testid="textbox"
102
  contenteditable=true
103
  class="text-container"
104
+ class:disabled={!interactive}
105
  bind:this={el}
106
  on:keypress={handle_keypress}
107
  on:blur={handle_blur}
src/pyproject.toml CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_rich_textbox"
11
- version = "0.4.0"
12
  description = "Gradio custom component for rich text input"
13
  readme = "README.md"
14
  license = "Apache-2.0"
@@ -43,7 +43,7 @@ classifiers = [
43
  dev = ["build", "twine"]
44
 
45
  [tool.hatch.build]
46
- artifacts = ["/backend/gradio_rich_textbox/templates", "*.pyi", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates"]
47
 
48
  [tool.hatch.build.targets.wheel]
49
  packages = ["/backend/gradio_rich_textbox"]
 
8
 
9
  [project]
10
  name = "gradio_rich_textbox"
11
+ version = "0.4.2"
12
  description = "Gradio custom component for rich text input"
13
  readme = "README.md"
14
  license = "Apache-2.0"
 
43
  dev = ["build", "twine"]
44
 
45
  [tool.hatch.build]
46
+ artifacts = ["/backend/gradio_rich_textbox/templates", "*.pyi", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates", "backend/gradio_rich_textbox/templates"]
47
 
48
  [tool.hatch.build.targets.wheel]
49
  packages = ["/backend/gradio_rich_textbox"]