Spaces:
Paused
Paused
Commit
·
9a6620f
1
Parent(s):
e165b8d
Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
app = FastAPI()
|
6 |
+
|
7 |
+
pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small")
|
8 |
+
|
9 |
+
@app.get("/")
|
10 |
+
def index(input):
|
11 |
+
output = pipe_flan(input)
|
12 |
+
return {"output": output[0]["generated_text"]}
|