from fastapi import FastAPI from transformers import pipeline import os app = FastAPI() pipe_flan = pipeline("text2text-generation", model="mistralai/Mistral-7B-v0.3") @app.get("/mistral") def mistral(input: str): output = pipe_flan(input) return {"output": output[0]["generated_text"]} @app.get("/") def greet_json(): return {"Hello": "World!"}