Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- __pycache__/gradify.cpython-310.pyc +0 -0
- demo.yaml +24 -32
- gradify.py +4 -8
- requirements.txt +1 -1
__pycache__/gradify.cpython-310.pyc
CHANGED
Binary files a/__pycache__/gradify.cpython-310.pyc and b/__pycache__/gradify.cpython-310.pyc differ
|
|
demo.yaml
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
lite_metadata:
|
2 |
gradio_version: 3.32.0
|
|
|
3 |
class_string: gradio.interface.Interface
|
4 |
kwargs:
|
5 |
-
title:
|
6 |
description: Given an array of distinct integers candidates and a target integer
|
7 |
target, return a list of all unique combinations of candidates where the chosen
|
8 |
numbers sum to target
|
@@ -12,40 +13,31 @@ kwargs:
|
|
12 |
css: null
|
13 |
allow_flagging: never
|
14 |
inputs:
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
label: target
|
24 |
-
precision: 0
|
25 |
outputs:
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
label: output
|
31 |
-
type: array
|
32 |
fn:
|
33 |
class_string: gradify.gradify_closure
|
34 |
kwargs:
|
35 |
argmaps:
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
- label: target
|
41 |
-
postprocessing: null
|
42 |
func_kwargs: {}
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
\ len(candidates)):\n if candidates[i] > target:\n \
|
50 |
-
\ break\n backtrack(i, path + [candidates[i]], target\
|
51 |
-
\ - candidates[i])\n backtrack(0, [], target)\n return res\n"
|
|
|
1 |
lite_metadata:
|
2 |
gradio_version: 3.32.0
|
3 |
+
liteobj_version: 0.0.7
|
4 |
class_string: gradio.interface.Interface
|
5 |
kwargs:
|
6 |
+
title: gitio sum combination
|
7 |
description: Given an array of distinct integers candidates and a target integer
|
8 |
target, return a list of all unique combinations of candidates where the chosen
|
9 |
numbers sum to target
|
|
|
13 |
css: null
|
14 |
allow_flagging: never
|
15 |
inputs:
|
16 |
+
- class_string: gradio.components.Dataframe
|
17 |
+
kwargs:
|
18 |
+
label: candidates
|
19 |
+
type: array
|
20 |
+
- class_string: gradio.components.Number
|
21 |
+
kwargs:
|
22 |
+
label: target
|
23 |
+
precision: 0
|
|
|
|
|
24 |
outputs:
|
25 |
+
- class_string: gradio.components.Dataframe
|
26 |
+
kwargs:
|
27 |
+
label: output
|
28 |
+
type: array
|
|
|
|
|
29 |
fn:
|
30 |
class_string: gradify.gradify_closure
|
31 |
kwargs:
|
32 |
argmaps:
|
33 |
+
- label: candidates
|
34 |
+
postprocessing: 'lambda array: list(map(int, array[0]))'
|
35 |
+
- label: target
|
36 |
+
postprocessing: null
|
|
|
|
|
37 |
func_kwargs: {}
|
38 |
+
source: "def combinationSum(candidates, target):\n res = []\n\n def backtrack(start,\
|
39 |
+
\ path, target):\n if target == 0:\n res.append(path)\n\
|
40 |
+
\ return\n for i in range(start, len(candidates)):\n \
|
41 |
+
\ if candidates[i] > target:\n break\n backtrack(i,\
|
42 |
+
\ path + [candidates[i]], target - candidates[i])\n backtrack(0, [], target)\n\
|
43 |
+
\ return res\n"
|
|
|
|
|
|
gradify.py
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
|
2 |
|
3 |
-
def gradify_closure(
|
4 |
|
|
|
|
|
|
|
5 |
from types import FunctionType
|
6 |
for k, v in ldict.items():
|
7 |
if isinstance(v, FunctionType):
|
@@ -29,10 +32,3 @@ def gradify_closure(ldict, argmaps, func_kwargs={}):
|
|
29 |
raise gr.Error(f"Error: {e}")
|
30 |
|
31 |
return gradify_func
|
32 |
-
|
33 |
-
def exec_to_dict(source, target=None):
|
34 |
-
|
35 |
-
ldict = {}
|
36 |
-
exec(source, globals(), ldict)
|
37 |
-
|
38 |
-
return ldict.get(target, None) if target else ldict
|
|
|
1 |
|
2 |
|
3 |
+
def gradify_closure(source, argmaps, func_kwargs={}):
|
4 |
|
5 |
+
ldict = {}
|
6 |
+
exec(source, globals(), ldict)
|
7 |
+
|
8 |
from types import FunctionType
|
9 |
for k, v in ldict.items():
|
10 |
if isinstance(v, FunctionType):
|
|
|
32 |
raise gr.Error(f"Error: {e}")
|
33 |
|
34 |
return gradify_func
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
gradio==3.32
|
2 |
-
liteobj==0.0.
|
|
|
1 |
gradio==3.32
|
2 |
+
liteobj==0.0.7
|