File size: 561 Bytes
deb83c9 072df7d deb83c9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import json
import os
from typing import List
from fastapi import FastAPI, HTTPException
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from model import generate_structure
app = FastAPI()
STRUCTURE_FILE = "structures.json"
structure_store = []
class Prompt(BaseModel):
text: str
class Structure(BaseModel):
name: str
description: str
required_blocks: List[str]
tags: List[str]
@app.post("/prompt")
async def prompt(prompt: Prompt):
result = generate_structure(prompt.text)
return {"response": result}
|