digital-twin / app.py
Scoodood's picture
refactor: update notification tool logic to enforce data collection requirements and improve logging configuration
76017de
Raw
History Blame Contribute Delete
1.39 kB
import warnings
import logging
import gradio as gr
from twin.bootstrap import bootstrap
warnings.filterwarnings("ignore", message=".*HTTP_422_UNPROCESSABLE_ENTITY.*")
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
agent, avatar_image = bootstrap()
def ai_response(message: str, history: list[dict]) -> str:
output = agent.generate_chat_response(message, history)
logger.debug(f"\n{'=' * 50}")
logger.debug(f"***Output: {output}")
return output
if __name__ == "__main__":
ui = gr.ChatInterface(
fn=ai_response,
title="Jeff's Digital Twin",
description=(
"Welcome to my Digital Twin—an interactive AI agent powered by RAG and "
"dynamic tool-calling. Ask about my experience, recent projects, or technical skills. "
"This is a beta version, so feel free to test its limits! If you have suggestions or "
"want to get in touch, just ask my twin to send me a real-time push notification."
),
chatbot=gr.Chatbot(avatar_images=(None, avatar_image), height=800),
examples=[
"What did you learn in the AI Engineering Workshop by SuperDataScience?",
"What are your interests?",
"Do you have any favorite movies?",
],
)
ui.launch(inbrowser=True, share=False)