Upload 3 files
Browse files- Dockerfile +0 -0
- app.py +19 -0
- requirements.txt +0 -0
Dockerfile
ADDED
|
File without changes
|
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
| 8 |
+
|
| 9 |
+
@app.get("/")
|
| 10 |
+
def home():
|
| 11 |
+
return{
|
| 12 |
+
"message":"Hello world"
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
@app.get("/generate")
|
| 16 |
+
def generate(text:str):
|
| 17 |
+
output=pipe(text)
|
| 18 |
+
|
| 19 |
+
return {"output":output[0]['genetated_text']}
|
requirements.txt
ADDED
|
File without changes
|