|
from fastapi import FastAPI |
|
from pydantic import BaseModel |
|
from typing import Dict |
|
|
|
from src.core import * |
|
|
|
app = FastAPI( |
|
title="Insight Finder", |
|
description="Find relevant technologies from a problem", |
|
) |
|
|
|
class InputData(BaseModel): |
|
problem: str |
|
|
|
class InputConstraints(BaseModel): |
|
data: Dict[str, str] |
|
|
|
class OutputData(BaseModel): |
|
technologies: list |
|
|
|
@app.post("/process", response_model=OutputData) |
|
async def process(data: InputData): |
|
result = process_input(data, global_tech, global_tech_embeddings) |
|
return {"technologies": result} |
|
|
|
|
|
@app.post("/process", response_model=OutputData) |
|
async def process(constraints: InputConstraints): |
|
result = process_input(constraints, global_tech, global_tech_embeddings) |
|
return {"technologies": result} |
|
|