Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,18 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
app
|
|
|
5 |
|
6 |
# Initialize the text generation pipeline
|
7 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
8 |
|
|
|
9 |
@app.get("/")
|
10 |
-
|
11 |
-
return {"message":
|
|
|
|
|
12 |
|
13 |
|
14 |
@app.get("/generate")
|
|
|
1 |
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
## create a new FASTAPI app instance
|
5 |
+
app=FastAPI()
|
6 |
|
7 |
# Initialize the text generation pipeline
|
8 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
9 |
|
10 |
+
|
11 |
@app.get("/")
|
12 |
+
def home():
|
13 |
+
return {"message":"Hello World"}
|
14 |
+
|
15 |
+
# Define a function to handle the GET request at `/generate`
|
16 |
|
17 |
|
18 |
@app.get("/generate")
|