Spaces:
Runtime error
Runtime error
File size: 1,448 Bytes
ca4ed58 1def064 ca4ed58 1def064 ca4ed58 | 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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # app/main.py
import os
from fastapi import FastAPI
from fastapi import Body
from fastapi import UploadFile, File
from fastapi.middleware.cors import CORSMiddleware
from app.core.orchestrator import process_call
from app.core.ibm_sanity import sanity_embeddings, sanity_generation
app = FastAPI(title="ClaimCheck")
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://127.0.0.1:5173",
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/health")
def health():
return {"status": "ok", "service": "ClaimCheck"}
@app.get("/health/ibm")
def health_ibm():
emb = sanity_embeddings()
claim = sanity_generation(os.getenv("IBM_CLAIM_MODEL_ID",""), "Say OK")
verify = sanity_generation(os.getenv("IBM_VERIFIER_MODEL_ID",""), "Say OK")
return {"embeddings": emb, "claim_gen": claim, "verify_gen": verify}
@app.post("/process-transcript")
def process_transcript(text: str = Body(..., embed=True)):
"""
Accepts raw transcript text and returns a CallReport JSON.
For now, the orchestrator returns a dummy report (no AI).
"""
report = process_call(transcript=text)
return report
@app.post("/process-audio")
async def process_audio(file: UploadFile = File(...)):
path = f"data/audio/{file.filename}"
with open(path, "wb") as f:
f.write(await file.read())
return process_call(audio_path=path) |