Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- __pycache__/gradify.cpython-310.pyc +0 -0
- demo.yaml +21 -29
- 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 two sorted arrays nums1 and nums2 of size m and n respectively,
|
| 7 |
return the median of the two sorted arrays
|
| 8 |
article: null
|
|
@@ -11,37 +12,28 @@ kwargs:
|
|
| 11 |
css: null
|
| 12 |
allow_flagging: never
|
| 13 |
inputs:
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
label: nums2
|
| 23 |
-
type: array
|
| 24 |
outputs:
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
kwargs:
|
| 29 |
-
label: output
|
| 30 |
fn:
|
| 31 |
class_string: gradify.gradify_closure
|
| 32 |
kwargs:
|
| 33 |
argmaps:
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
- label: nums2
|
| 39 |
-
postprocessing: 'lambda array: list(map(int, array[0]))'
|
| 40 |
func_kwargs: {}
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
\ nums1.sort()\n n = len(nums1)\n if n % 2 == 0:\n return\
|
| 46 |
-
\ (nums1[n // 2] + nums1[n // 2 - 1]) / 2\n else:\n return nums1[n\
|
| 47 |
-
\ // 2]\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 array median
|
| 7 |
description: Given two sorted arrays nums1 and nums2 of size m and n respectively,
|
| 8 |
return the median of the two sorted arrays
|
| 9 |
article: null
|
|
|
|
| 12 |
css: null
|
| 13 |
allow_flagging: never
|
| 14 |
inputs:
|
| 15 |
+
- class_string: gradio.components.Dataframe
|
| 16 |
+
kwargs:
|
| 17 |
+
label: nums1
|
| 18 |
+
type: array
|
| 19 |
+
- class_string: gradio.components.Dataframe
|
| 20 |
+
kwargs:
|
| 21 |
+
label: nums2
|
| 22 |
+
type: array
|
|
|
|
|
|
|
| 23 |
outputs:
|
| 24 |
+
- class_string: gradio.components.Number
|
| 25 |
+
kwargs:
|
| 26 |
+
label: output
|
|
|
|
|
|
|
| 27 |
fn:
|
| 28 |
class_string: gradify.gradify_closure
|
| 29 |
kwargs:
|
| 30 |
argmaps:
|
| 31 |
+
- label: nums1
|
| 32 |
+
postprocessing: 'lambda array: list(map(int, array[0]))'
|
| 33 |
+
- label: nums2
|
| 34 |
+
postprocessing: 'lambda array: list(map(int, array[0]))'
|
|
|
|
|
|
|
| 35 |
func_kwargs: {}
|
| 36 |
+
source: "def findMedianSortedArrays(nums1, nums2):\n nums1.extend(nums2)\n\
|
| 37 |
+
\ nums1.sort()\n n = len(nums1)\n if n % 2 == 0:\n return\
|
| 38 |
+
\ (nums1[n // 2] + nums1[n // 2 - 1]) / 2\n else:\n return nums1[n\
|
| 39 |
+
\ // 2]\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
|