Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from transformers import pipeline | |
| app = FastAPI() | |
| pipeline = pipeline("text2text-generation", model="google/flan-t5-small") | |
| def home(): | |
| return {"message": "Welcome to the Text Generation API!"} | |
| def generate(text: str): | |
| output = pipeline(text) | |
| return {"generated_text": output[0]['generated_text']} | |