Spaces:
Sleeping
Sleeping
| # from fastapi import FastAPI | |
| # from typing import List | |
| # import nest_asyncio | |
| # import uvicorn | |
| # from pyngrok import ngrok | |
| # import pandas as pd | |
| # # Assuming UniversalRedactionEngine is pasted/imported above | |
| # from engine import UniversalRedactionEngine | |
| # from redacto.common.schemas import DocumentBlock | |
| # app = FastAPI(title="GPU Engine") | |
| # analyzer = UniversalRedactionEngine() | |
| # @app.post("/analyze") | |
| # def analyze_block(blocks: List[DocumentBlock]): | |
| # # Convert incoming network data to DataFrame | |
| # df_layout = pd.DataFrame([b.model_dump() for b in blocks]) | |
| # # Run GPU Inference | |
| # df_plan = analyzer.process_dataframe(df_layout) | |
| # # Return JSON Redaction Plan | |
| # return df_plan.to_dict(orient="records") | |
| # if __name__ == "__main__": | |
| # ngrok.set_auth_token("YOUR_NGROK_TOKEN") | |
| # public_url = ngrok.connect(8000).public_url | |
| # print(f"🔥 KAGGLE API LIVE AT: {public_url}/analyze") | |
| # nest_asyncio.apply() | |
| # uvicorn.run(app, host="0.0.0.0", port=8000) |