File size: 1,017 Bytes
9f0f92b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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)