Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Dockerfile +0 -0
- app.py +15 -0
- requirements.txt +6 -0
Dockerfile
ADDED
|
File without changes
|
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
app=FastAPI()
|
| 5 |
+
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 6 |
+
|
| 7 |
+
@app.get("/")
|
| 8 |
+
def home():
|
| 9 |
+
return {"message: Hello world"}
|
| 10 |
+
|
| 11 |
+
@app.get("/generate")
|
| 12 |
+
def generate(text:str):
|
| 13 |
+
output=pipe(text)
|
| 14 |
+
return {"output":output[0]["generate_text"]}
|
| 15 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi==0.74.*
|
| 2 |
+
requests==2.27.*
|
| 3 |
+
unicorn[standard]==0.17.*
|
| 4 |
+
sentencepiece==0.1.*
|
| 5 |
+
torch==1.11.*
|
| 6 |
+
transformers==4.*
|