Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from transformers import pipeline | |
| app = FastAPI() | |
| pipe = pipeline("text-generation", model="MohamedSaeed-dev/gemma-2b-1500steps") | |
| async def generate_text(text:str): | |
| messages = [ | |
| {"role": "user", "content": text}, | |
| ] | |
| output = pipe(messages) | |
| return {"output": output[0]["generated_text"]} | |
| async def root(): | |
| return {"message": "Welcome to the LLM API!"} | |