Spaces:
Runtime error
Runtime error
Download app.py from nitinplays247/google-gemma-api: direct link, hf CLI and curl.
- Browser
- Download file 417 Bytes
-
https://huggingface.co/spaces/nitinplays247/google-gemma-api/resolve/main/app.py
- Command line
-
hf download hf://spaces/nitinplays247/google-gemma-api/app.py
-
curl -L -o app.py https://huggingface.co/spaces/nitinplays247/google-gemma-api/resolve/main/app.py
417 Bytes
| from fastapi import FastAPI | |
| from transformers import pipeline | |
| app = FastAPI() | |
| # Load a small generative text model | |
| pipe = pipeline("text-generation", model="google/flan-t5-base") | |
| def home(): | |
| return {"status": "API is running successfully"} | |
| def generate(prompt: str): | |
| response = pipe(prompt, return_full_text=False) | |
| return {"result": response[0]['generated_text']} | |