File size: 1,979 Bytes
368277b
 
 
 
 
 
 
54df027
368277b
 
 
 
54df027
 
368277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54df027
 
 
368277b
 
 
 
54df027
 
 
368277b
 
 
 
54df027
 
da3a984
54df027
 
 
 
 
 
368277b
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
ReMind - A Comprehensive Digital Assistant
A multi-agent system for Gmail management, bookmarks, and web search.
Built for the Agents-MCP-Hackathon 2025.
"""

import os
import sys
from dotenv import load_dotenv

load_dotenv()

print(f"Python version: {sys.version}")


def main():
    """Main application entry point for Hugging Face Spaces"""
    print("πŸš€ Starting ReMind Digital Assistant...")

    hf_token = os.getenv("HF_TOKEN")
    if not hf_token:
        print("⚠️  Warning: HF_TOKEN not found. Some features may be limited.")

    google_client_id = os.getenv("GOOGLE_CLIENT_ID")
    google_client_secret = os.getenv("GOOGLE_CLIENT_SECRET")
    google_refresh_token = os.getenv("GOOGLE_REFRESH_TOKEN")

    if not google_client_id or not google_client_secret:
        print("⚠️  Gmail integration requires OAuth credentials in Spaces secrets.")
    elif not google_refresh_token:
        print("⚠️  Gmail integration may require re-authentication.")
    else:
        print("βœ… Gmail OAuth credentials configured.")

    try:
        from src.interfaces.gradio_interface import demo

        print("βœ… ReMind Digital Assistant ready!")
        print("πŸ€” Real-time AI thinking display enabled")
        print("πŸ“§ Email β€’ 🌐 Web Search β€’ πŸ”– Bookmarks")

        return demo

    except ImportError as e:
        print(f"❌ Import error: {e}")
        print("Please ensure all dependencies are installed.")
        import traceback

        traceback.print_exc()
        raise

    except Exception as e:
        print(f"❌ Error starting ReMind: {e}")
        import traceback

        traceback.print_exc()
        raise


if __name__ == "__main__":
    try:
        demo = main()
        demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)
    except Exception as e:
        print(f"❌ Critical error during launch: {e}")
        import traceback

        traceback.print_exc()
        sys.exit(1)
else:
    demo = main()