Brian P Johnson commited on
Commit
3c2631e
·
1 Parent(s): 4c62e65

Adding initial application, which will change significantly

Browse files
Files changed (7) hide show
  1. .idea/.gitignore +5 -0
  2. .idea/modules.xml +8 -0
  3. .idea/vcs.xml +6 -0
  4. .idea/waste.iml +12 -0
  5. Dockerfile +20 -0
  6. app.py +20 -0
  7. requirements.txt +48 -0
.idea/.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/waste.iml" filepath="$PROJECT_DIR$/.idea/waste.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
.idea/waste.iml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
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.9
5
+
6
+ WORKDIR /code
7
+
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
+
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV HOME=/home/user
15
+ ENV PATH=/home/user/.local/bin:$PATH
16
+
17
+ WORKDIR $HOME/app
18
+ COPY --chown=user . $HOME/app
19
+
20
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
+
4
+
5
+ # NOTE - we configure docs_url to serve the interactive Docs at the root path
6
+ # of the app. This way, we can use the docs as a landing page for the app on Spaces.
7
+ app = FastAPI(docs_url="/")
8
+
9
+ pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
+
11
+
12
+ @app.get("/generate")
13
+ def generate(text: str):
14
+ """
15
+ Using the text2text-generation pipeline from `transformers`, generate text
16
+ from the given input text. The model used is `google/flan-t5-small`, which
17
+ can be found [here](https://huggingface.co/google/flan-t5-small).
18
+ """
19
+ output = pipe(text)
20
+ return {"output": output[0]["generated_text"]}
requirements.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ annotated-types==0.6.0
2
+ anyio==3.7.1
3
+ certifi==2023.7.22
4
+ charset-normalizer==3.3.2
5
+ click==8.1.7
6
+ exceptiongroup==1.1.3
7
+ fastapi==0.104.1
8
+ filelock==3.13.1
9
+ fsspec==2023.10.0
10
+ h11==0.14.0
11
+ huggingface-hub==0.17.3
12
+ idna==3.4
13
+ Jinja2==3.1.2
14
+ MarkupSafe==2.1.3
15
+ mpmath==1.3.0
16
+ networkx==3.2.1
17
+ numpy==1.26.1
18
+ nvidia-cublas-cu12==12.1.3.1
19
+ nvidia-cuda-cupti-cu12==12.1.105
20
+ nvidia-cuda-nvrtc-cu12==12.1.105
21
+ nvidia-cuda-runtime-cu12==12.1.105
22
+ nvidia-cudnn-cu12==8.9.2.26
23
+ nvidia-cufft-cu12==11.0.2.54
24
+ nvidia-curand-cu12==10.3.2.106
25
+ nvidia-cusolver-cu12==11.4.5.107
26
+ nvidia-cusparse-cu12==12.1.0.106
27
+ nvidia-nccl-cu12==2.18.1
28
+ nvidia-nvjitlink-cu12==12.3.52
29
+ nvidia-nvtx-cu12==12.1.105
30
+ packaging==23.2
31
+ pydantic==2.4.2
32
+ pydantic_core==2.10.1
33
+ PyYAML==6.0.1
34
+ regex==2023.10.3
35
+ requests==2.31.0
36
+ safetensors==0.4.0
37
+ sentencepiece==0.1.99
38
+ sniffio==1.3.0
39
+ starlette==0.27.0
40
+ sympy==1.12
41
+ tokenizers==0.14.1
42
+ torch==2.1.0
43
+ tqdm==4.66.1
44
+ transformers==4.35.0
45
+ triton==2.1.0
46
+ typing_extensions==4.8.0
47
+ urllib3==2.0.7
48
+ uvicorn==0.24.0.post1