File size: 717 Bytes
ffcf8df | 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 | """Frontend handler — bridges the Streamlit UI with the FastAPI backend."""
import requests
BASE_URL = "http://localhost:8000"
def fix_newlines(text: str, model_name: str | None = None) -> dict:
payload = {"text": text}
if model_name:
payload["model_name"] = model_name
resp = requests.post(f"{BASE_URL}/fix-newlines", json=payload)
resp.raise_for_status()
return resp.json()
def fix_newlines_all_models(text: str) -> dict:
resp = requests.post(f"{BASE_URL}/fix-newlines-all-models", json={"text": text})
resp.raise_for_status()
return resp.json()
def health() -> dict:
resp = requests.get(f"{BASE_URL}/health")
resp.raise_for_status()
return resp.json()
|