Upload folder using huggingface_hub
Browse files- __pycache__/gradify.cpython-310.pyc +0 -0
- demo.yaml +9 -26
- gradify.py +1 -4
__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
@@ -3,8 +3,7 @@ lite_metadata:
|
|
3 |
class_string: gradio.interface.Interface
|
4 |
kwargs:
|
5 |
title: Gradio Webapp
|
6 |
-
description: Given
|
7 |
-
return the median of the two sorted arrays
|
8 |
article: null
|
9 |
thumbnail: null
|
10 |
theme: gradio/seafoam
|
@@ -15,43 +14,27 @@ kwargs:
|
|
15 |
args:
|
16 |
- class_string: gradio.components.Dataframe
|
17 |
kwargs:
|
18 |
-
label:
|
19 |
-
type: array
|
20 |
-
- class_string: gradio.components.Dataframe
|
21 |
-
kwargs:
|
22 |
-
label: nums2
|
23 |
type: array
|
24 |
outputs:
|
25 |
class_string: liteobj.listify
|
26 |
args:
|
27 |
-
- class_string: gradio.components.
|
28 |
kwargs:
|
29 |
label: output
|
|
|
30 |
fn:
|
31 |
class_string: gradify.gradify_closure
|
32 |
kwargs:
|
33 |
argmaps:
|
34 |
class_string: liteobj.listify
|
35 |
args:
|
36 |
-
- label:
|
37 |
-
postprocessing: 'lambda array: list(map(
|
38 |
-
- label: nums2
|
39 |
-
postprocessing: 'lambda array: list(map(int, array[0]))'
|
40 |
func_kwargs: {}
|
41 |
ldict:
|
42 |
class_string: gradify.exec_to_dict
|
43 |
kwargs:
|
44 |
-
source: "
|
45 |
-
\
|
46 |
-
\
|
47 |
-
\ i = (i_min + i_max) // 2\n j = half_len - i\n if\
|
48 |
-
\ i < m and nums2[j - 1] > nums1[i]:\n i_min = i + 1\n \
|
49 |
-
\ elif i > 0 and nums1[i - 1] > nums2[j]:\n i_max = i -\
|
50 |
-
\ 1\n else:\n if i == 0:\n max_of_left\
|
51 |
-
\ = nums2[j - 1]\n elif j == 0:\n max_of_left\
|
52 |
-
\ = nums1[i - 1]\n else:\n max_of_left = max(nums1[i\
|
53 |
-
\ - 1], nums2[j - 1])\n if (m + n) % 2 == 1:\n \
|
54 |
-
\ return max_of_left\n if i == m:\n min_of_right\
|
55 |
-
\ = nums2[j]\n elif j == n:\n min_of_right =\
|
56 |
-
\ nums1[i]\n else:\n min_of_right = min(nums1[i],\
|
57 |
-
\ nums2[j])\n return (max_of_left + min_of_right) / 2.0\n"
|
|
|
3 |
class_string: gradio.interface.Interface
|
4 |
kwargs:
|
5 |
title: Gradio Webapp
|
6 |
+
description: Given list of strings, create regex to extract dates
|
|
|
7 |
article: null
|
8 |
thumbnail: null
|
9 |
theme: gradio/seafoam
|
|
|
14 |
args:
|
15 |
- class_string: gradio.components.Dataframe
|
16 |
kwargs:
|
17 |
+
label: strings
|
|
|
|
|
|
|
|
|
18 |
type: array
|
19 |
outputs:
|
20 |
class_string: liteobj.listify
|
21 |
args:
|
22 |
+
- class_string: gradio.components.Dataframe
|
23 |
kwargs:
|
24 |
label: output
|
25 |
+
type: array
|
26 |
fn:
|
27 |
class_string: gradify.gradify_closure
|
28 |
kwargs:
|
29 |
argmaps:
|
30 |
class_string: liteobj.listify
|
31 |
args:
|
32 |
+
- label: strings
|
33 |
+
postprocessing: 'lambda array: list(map(str, array[0]))'
|
|
|
|
|
34 |
func_kwargs: {}
|
35 |
ldict:
|
36 |
class_string: gradify.exec_to_dict
|
37 |
kwargs:
|
38 |
+
source: "import re\n\n\ndef func(strings):\n regex = '\\\\d{1,2}/\\\\\
|
39 |
+
d{1,2}/\\\\d{4}'\n dates = []\n for string in strings:\n \
|
40 |
+
\ dates += re.findall(regex, string)\n return dates\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gradify.py
CHANGED
@@ -29,7 +29,4 @@ def exec_to_dict(source, target=None):
|
|
29 |
ldict = {}
|
30 |
exec(source, globals(), ldict)
|
31 |
|
32 |
-
if target
|
33 |
-
return ldict.get(target, None)
|
34 |
-
|
35 |
-
return ldict
|
|
|
29 |
ldict = {}
|
30 |
exec(source, globals(), ldict)
|
31 |
|
32 |
+
return ldict.get(target, None) if target else ldict
|
|
|
|
|
|