lint commited on
Commit
29046a4
·
1 Parent(s): 452d7f3

Upload folder using huggingface_hub

Browse files
Dockerfile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ WORKDIR /code
4
+
5
+ COPY ./requirements.txt /code/requirements.txt
6
+
7
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
+
9
+ # Set up a new user named "user" with user ID 1000
10
+ RUN useradd -m -u 1000 user
11
+ # Switch to the "user" user
12
+ USER user
13
+ # Set home to the user's home directory
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
16
+
17
+ # Set the working directory to the user's home directory
18
+ WORKDIR $HOME/app
19
+
20
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
21
+ COPY --chown=user . $HOME/app
22
+
23
+ CMD ["lite", "demo.yaml", "launch", "--server_name", "0.0.0.0", "--server_port", "7860"]
__init__.py ADDED
File without changes
__pycache__/__init__.cpython-310.pyc ADDED
Binary file (143 Bytes). View file
 
__pycache__/gradify.cpython-310.pyc ADDED
Binary file (871 Bytes). View file
 
demo.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ lite_metadata:
2
+ gradio_version: 3.32.0
3
+ class_string: gradio.interface.Interface
4
+ kwargs:
5
+ title: Gradio Webapp
6
+ description: ''
7
+ article: null
8
+ thumbnail: null
9
+ theme: gradio/seafoam
10
+ css: null
11
+ allow_flagging: never
12
+ inputs:
13
+ class_string: liteobj.listify
14
+ args:
15
+ - class_string: gradio.components.Textbox
16
+ kwargs:
17
+ label: s
18
+ outputs:
19
+ class_string: liteobj.listify
20
+ args:
21
+ - class_string: gradio.components.Number
22
+ kwargs:
23
+ label: output
24
+ precision: 0
25
+ fn:
26
+ class_string: gradify.gradify_closure
27
+ kwargs:
28
+ func:
29
+ class_string: gradify.compile_callable
30
+ kwargs:
31
+ source: "def func(s):\n char_dict = {}\n max_length = 0\n start\
32
+ \ = 0\n for end in range(len(s)):\n if s[end] in char_dict:\n\
33
+ \ start = max(start, char_dict[s[end]] + 1)\n char_dict[s[end]]\
34
+ \ = end\n max_length = max(max_length, end - start + 1)\n return\
35
+ \ max_length\n"
36
+ target_name: func
37
+ argmaps:
38
+ class_string: liteobj.listify
39
+ args:
40
+ - label: s
41
+ postprocessing: null
42
+ func_kwargs: {}
gradify.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def gradify_closure(func, argmaps, func_kwargs={}):
2
+
3
+ func_kwargs = dict(func_kwargs)
4
+
5
+ def gradify_func(*args):
6
+
7
+ kwargs = {}
8
+ for (arg, argmap) in zip(args, argmaps):
9
+
10
+ postprocessing = argmap.get("postprocessing", None)
11
+ if postprocessing:
12
+ arg = eval(postprocessing)(arg)
13
+
14
+ kw_label = argmap["label"]
15
+ kwargs[kw_label] = arg
16
+
17
+ return func(**kwargs, **func_kwargs)
18
+
19
+ return gradify_func
20
+
21
+ def compile_callable(source, target_name=None):
22
+
23
+ ldict = {}
24
+ exec(source, globals(), ldict)
25
+
26
+ if target_name:
27
+ return ldict[target_name]
28
+ else:
29
+ for v in ldict.values():
30
+ if callable(v):
31
+ return v
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio==3.32
2
+ liteobj==0.0.4