Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- demo.yaml +3 -7
- gradify.py +4 -8
demo.yaml
CHANGED
@@ -4,7 +4,7 @@ lite_metadata:
|
|
4 |
class_string: gradio.interface.Interface
|
5 |
kwargs:
|
6 |
title: gitio count hello
|
7 |
-
description:
|
8 |
the substring 'hello world'
|
9 |
article: null
|
10 |
thumbnail: null
|
@@ -28,9 +28,5 @@ kwargs:
|
|
28 |
- label: df
|
29 |
postprocessing: null
|
30 |
func_kwargs: {}
|
31 |
-
|
32 |
-
|
33 |
-
kwargs:
|
34 |
-
source: "import pandas as pd\n\n\ndef count_hello_world(df):\n return\
|
35 |
-
\ df.astype(str).apply(lambda x: x.str.contains('hello world')).sum(\n\
|
36 |
-
\ ).sum()\n"
|
|
|
4 |
class_string: gradio.interface.Interface
|
5 |
kwargs:
|
6 |
title: gitio count hello
|
7 |
+
description: Given a pandas dataframe, count the number of entries that contain
|
8 |
the substring 'hello world'
|
9 |
article: null
|
10 |
thumbnail: null
|
|
|
28 |
- label: df
|
29 |
postprocessing: null
|
30 |
func_kwargs: {}
|
31 |
+
source: "import pandas as pd\n\n\ndef count_hello_world(df):\n return df.astype(str).apply(lambda\
|
32 |
+
\ x: x.str.contains('hello world')).sum(\n ).sum()\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
|
|
|
|
|
|
|
|
|
|
|
|
|
|