Spaces:
Sleeping
Sleeping
Commit
·
91772d4
1
Parent(s):
3e63fcb
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
app = FastAPI()
|
5 |
+
|
6 |
+
pipe = pipeline('text2text-generation', model = 'google/flan-t5-small')
|
7 |
+
|
8 |
+
|
9 |
+
@app.get('/generate')
|
10 |
+
def generate(text):
|
11 |
+
|
12 |
+
output = pipe(text)
|
13 |
+
|
14 |
+
return {"output": output[0]['generated_text']}
|
15 |
+
|