Upload folder using huggingface_hub
Browse files- __pycache__/gradify.cpython-310.pyc +0 -0
- demo.yaml +16 -12
- gradify.py +3 -3
__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
@@ -4,29 +4,33 @@ lite_metadata:
|
|
4 |
class_string: gradio.interface.Interface
|
5 |
kwargs:
|
6 |
title: Gradio Webapp
|
7 |
-
description:
|
8 |
article: null
|
9 |
thumbnail: null
|
10 |
theme: gradio/seafoam
|
11 |
css: null
|
12 |
allow_flagging: never
|
13 |
inputs:
|
14 |
-
- class_string: gradio.components.
|
15 |
kwargs:
|
16 |
-
label:
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
outputs:
|
19 |
-
- class_string: gradio.components.
|
20 |
kwargs:
|
21 |
label: output
|
22 |
-
|
23 |
fn:
|
24 |
-
class_string: gradify.
|
25 |
kwargs:
|
26 |
argmaps:
|
27 |
-
- label:
|
28 |
-
postprocessing:
|
|
|
|
|
29 |
func_kwargs: {}
|
30 |
-
source: "def
|
31 |
-
\ for num in nums:\n if num in seen:\n duplicates.add(num)\n\
|
32 |
-
\ else:\n seen.add(num)\n return list(duplicates)\n"
|
|
|
4 |
class_string: gradio.interface.Interface
|
5 |
kwargs:
|
6 |
title: Gradio Webapp
|
7 |
+
description: add two numbers
|
8 |
article: null
|
9 |
thumbnail: null
|
10 |
theme: gradio/seafoam
|
11 |
css: null
|
12 |
allow_flagging: never
|
13 |
inputs:
|
14 |
+
- class_string: gradio.components.Number
|
15 |
kwargs:
|
16 |
+
label: a
|
17 |
+
precision: 0
|
18 |
+
- class_string: gradio.components.Number
|
19 |
+
kwargs:
|
20 |
+
label: b
|
21 |
+
precision: 0
|
22 |
outputs:
|
23 |
+
- class_string: gradio.components.Number
|
24 |
kwargs:
|
25 |
label: output
|
26 |
+
precision: 0
|
27 |
fn:
|
28 |
+
class_string: gradify.closure
|
29 |
kwargs:
|
30 |
argmaps:
|
31 |
+
- label: a
|
32 |
+
postprocessing: null
|
33 |
+
- label: b
|
34 |
+
postprocessing: null
|
35 |
func_kwargs: {}
|
36 |
+
source: "def add_numbers(a, b):\n return a + b"
|
|
|
|
gradify.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
|
2 |
|
3 |
-
def
|
4 |
|
5 |
ldict = {}
|
6 |
exec(source, globals(), ldict)
|
@@ -14,7 +14,7 @@ def gradify_closure(source, argmaps, func_kwargs={}):
|
|
14 |
globals().update(ldict)
|
15 |
func_kwargs = dict(func_kwargs)
|
16 |
|
17 |
-
def
|
18 |
|
19 |
try:
|
20 |
for (arg, argmap) in zip(args, argmaps):
|
@@ -31,4 +31,4 @@ def gradify_closure(source, argmaps, func_kwargs={}):
|
|
31 |
import gradio as gr
|
32 |
raise gr.Error(f"Error: {e}")
|
33 |
|
34 |
-
return
|
|
|
1 |
|
2 |
|
3 |
+
def closure(source, argmaps, func_kwargs={}):
|
4 |
|
5 |
ldict = {}
|
6 |
exec(source, globals(), ldict)
|
|
|
14 |
globals().update(ldict)
|
15 |
func_kwargs = dict(func_kwargs)
|
16 |
|
17 |
+
def gradio_func(*args):
|
18 |
|
19 |
try:
|
20 |
for (arg, argmap) in zip(args, argmaps):
|
|
|
31 |
import gradio as gr
|
32 |
raise gr.Error(f"Error: {e}")
|
33 |
|
34 |
+
return gradio_func
|