czqi commited on
Commit
5fc224c
1 Parent(s): a7547e8

Upload with huggingface_hub

Browse files
Files changed (4) hide show
  1. Dockerfile +20 -0
  2. app.py +14 -0
  3. requirements.txt +1 -0
  4. workcell.yaml +10 -0
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.8
5
+
6
+ # Set up a new user named "user" with user ID 1000
7
+ RUN useradd -m -u 1000 user
8
+ # Switch to the "user" user
9
+ USER user
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+ # Set the working directory to the user's home directory
14
+ WORKDIR $HOME/app
15
+
16
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
17
+ COPY --chown=user . $HOME/app
18
+ RUN pip install --no-cache-dir --upgrade -r $HOME/app/requirements.txt
19
+
20
+ CMD ["workcell", "serve", "--config", "workcell.yaml", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pydantic import BaseModel
2
+ import workcell
3
+
4
+ class Input(BaseModel):
5
+ message: str
6
+
7
+ class Output(BaseModel):
8
+ message: str
9
+
10
+ def hello_workcell(input: Input) -> Output:
11
+ """Returns the `message` of the input data."""
12
+ return Output(message=input.message)
13
+
14
+ app = workcell.create_app(hello_workcell)
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ workcell
workcell.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ workcell_name: hello_workcell
2
+ workcell_provider: huggingface
3
+ workcell_id: czqi/hello_workcell
4
+ workcell_version: latest
5
+ workcell_runtime: python3.8
6
+ workcell_entrypoint: app:hello_workcell
7
+ workcell_code:
8
+ ImageUri: ''
9
+ workcell_tags: {}
10
+ workcell_envs: {}