Kryko7
commited on
Commit
•
0d1c01a
1
Parent(s):
c44e55e
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,13 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
app = FastAPI(
|
5 |
-
version="1.0",
|
6 |
-
openapi_url="/openapi.json",
|
7 |
-
docs_url="/swagger",
|
8 |
-
redoc_url=None,
|
9 |
-
)
|
10 |
|
11 |
|
12 |
pipe = pipeline("text-generation", model="google/flan-t5-small")
|
13 |
|
14 |
|
15 |
-
@app.get("/")
|
16 |
def generate(query: str):
|
17 |
output = pipe(query, max_length=50, do_sample=True, top_k=50)
|
18 |
return {"output": output[0]["generated_text"], "query": query, "model": "google/flan-t5-small"}
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
|
7 |
pipe = pipeline("text-generation", model="google/flan-t5-small")
|
8 |
|
9 |
|
10 |
+
@app.get("/generate")
|
11 |
def generate(query: str):
|
12 |
output = pipe(query, max_length=50, do_sample=True, top_k=50)
|
13 |
return {"output": output[0]["generated_text"], "query": query, "model": "google/flan-t5-small"}
|