File size: 1,082 Bytes
3bb6958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# app.py - Main application entry point
from fastapi import FastAPI
import gradio as gr
import uvicorn
from agent import ARCollectionAgent
from ui import create_interface
from config import APP_TITLE, APP_HOST, APP_PORT

# Initialize FastAPI app
app = FastAPI(
    title=APP_TITLE,
    description="AI Agent for Accounts Receivable Collections (Demo)",
    version="1.0.0"
)

# Initialize the AR Collection Agent
agent = ARCollectionAgent()

# Create Gradio interface
demo = create_interface(agent)

# Mount Gradio app on FastAPI
app = gr.mount_gradio_app(app, demo, path="/")

# Health check endpoint
@app.get("/health")
async def health_check():
    return {"status": "healthy", "service": APP_TITLE}

if __name__ == "__main__":
    print(f"πŸš€ Starting {APP_TITLE}...")
    print(f"πŸ“ Access the app at: http://{APP_HOST}:{APP_PORT}")
    print("⚠️  Remember: This is a DEMO - no emails are actually sent!")
    
    # Run the application
    uvicorn.run(
        app,
        host=APP_HOST,
        port=APP_PORT,
        reload=False  # Set to True for development
    )