Spaces:
Sleeping
Sleeping
| import logging | |
| from fastapi import FastAPI, Request | |
| from fastapi.responses import FileResponse | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| app = FastAPI() | |
| def favicon(): | |
| return FileResponse("static/favicon.ico", media_type="image/x-icon") | |
| def home(): | |
| return "Hello World" | |
| async def webhook(request: Request): | |
| data = await request.json() | |
| logger.info(data) | |
| intent_name = data['queryResult']['intent']['displayName'] | |
| confidence_score = data['queryResult']['intentDetectionConfidence'] | |
| return {"fulfillmentText": f"I am {round(confidence_score*100, 2)}% certain you are talking about {intent_name}."} | |