Spaces:
Sleeping
Sleeping
File size: 316 Bytes
6f92752 1011f56 6f92752 1011f56 6f92752 1011f56 6f92752 1011f56 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from fastapi import FastAPI
from transformers import pipeline
app = FastAPI()
@app.get('/')
def home():
return {"hello": "world"}
@app.get('/ask')
def ask(prompt: str):
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
output = pipe(prompt)
return output[0]['generated_text']
|