lint commited on
Commit
3110a65
·
1 Parent(s): 858bbc1

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. demo.yaml +2 -5
  2. gradify.py +4 -8
demo.yaml CHANGED
@@ -28,8 +28,5 @@ kwargs:
28
  - label: df
29
  postprocessing: null
30
  func_kwargs: {}
31
- ldict:
32
- class_string: gradify.exec_to_dict
33
- kwargs:
34
- source: "import pandas as pd\n\n\ndef convert_and_multiply(df):\n return\
35
- \ df.apply(lambda x: x.astype(int) * x.index, axis=1)\n"
 
28
  - label: df
29
  postprocessing: null
30
  func_kwargs: {}
31
+ source: "import pandas as pd\n\n\ndef convert_and_multiply(df):\n return\
32
+ \ df.apply(lambda x: x.astype(int) * x.index, axis=1)\n"
 
 
 
gradify.py CHANGED
@@ -1,7 +1,10 @@
1
 
2
 
3
- def gradify_closure(ldict, argmaps, func_kwargs={}):
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