Shrijanagain commited on
Commit
0eaeeb5
Β·
verified Β·
1 Parent(s): d9658f5

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +75 -0
  2. requirements.txt +23 -0
app.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ """
3
+ SKT Search - Complete Application
4
+ ==================================
5
+ Mounts all interfaces:
6
+ - / β†’ Main Search UI
7
+ - /admin β†’ Admin Panel (ST-X password)
8
+ - /playground β†’ API Playground
9
+ - /docs β†’ API Documentation
10
+ - /keys β†’ API Key Management
11
+ - /api/* β†’ REST API Endpoints
12
+
13
+ URL: https://huggingface.co/spaces/shrijaagain/AI-ST
14
+ """
15
+
16
+ import gradio as gr
17
+ from fastapi import FastAPI
18
+ from fastapi.middleware.cors import CORSMiddleware
19
+ import uvicorn
20
+
21
+ from skt_search.ui.gradio_ui import SKTSearchUI
22
+ from skt_search.admin.admin_panel import AdminPanel
23
+ from skt_search.ui.playground import SKTPlayground
24
+ from skt_search.ui.api_docs import create_api_docs
25
+ from skt_search.ui.key_management import KeyManagementPage
26
+ from skt_search.api.fastapi_app import app as api_app
27
+
28
+ # Create main FastAPI app
29
+ app = FastAPI(
30
+ title="SKT Search",
31
+ description="AI-Powered Search Engine with RAG, LangGraph, and Heavy Browser",
32
+ version="1.0.0"
33
+ )
34
+
35
+ # Add CORS
36
+ app.add_middleware(
37
+ CORSMiddleware,
38
+ allow_origins=["*"],
39
+ allow_credentials=True,
40
+ allow_methods=["*"],
41
+ allow_headers=["*"],
42
+ )
43
+
44
+ # Mount API routes
45
+ for route in api_app.routes:
46
+ app.routes.append(route)
47
+
48
+ # Create all Gradio interfaces
49
+ search_ui = SKTSearchUI()
50
+ main_interface = search_ui.create_interface()
51
+
52
+ admin = AdminPanel()
53
+ admin_interface = admin.create_interface()
54
+
55
+ playground = SKTPlayground()
56
+ playground_interface = playground.create_interface()
57
+
58
+ api_docs_interface = create_api_docs()
59
+
60
+ key_page = KeyManagementPage()
61
+ key_interface = key_page.create_interface()
62
+
63
+ # Mount all Gradio apps
64
+ app = gr.mount_gradio_app(app, main_interface, path="/")
65
+ app = gr.mount_gradio_app(app, admin_interface, path="/admin")
66
+ app = gr.mount_gradio_app(app, playground_interface, path="/playground")
67
+ app = gr.mount_gradio_app(app, api_docs_interface, path="/docs")
68
+ app = gr.mount_gradio_app(app, key_interface, path="/keys")
69
+
70
+ @app.get("/health")
71
+ def health_check():
72
+ return {"status": "healthy", "version": "1.0.0"}
73
+
74
+ if __name__ == "__main__":
75
+ uvicorn.run(app, host="0.0.0.0", port=7860)
requirements.txt ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gradio>=4.0.0
2
+ fastapi>=0.104.0
3
+ uvicorn>=0.24.0
4
+ httpx>=0.25.0
5
+ beautifulsoup4>=4.12.0
6
+ trafilatura>=1.6.0
7
+ langchain>=0.1.0
8
+ langgraph>=0.0.20
9
+ huggingface-hub>=0.19.0
10
+ transformers>=4.35.0
11
+ torch>=2.1.0
12
+ sentence-transformers>=2.2.0
13
+ faiss-cpu>=1.7.4
14
+ requests>=2.31.0
15
+ aiohttp>=3.9.0
16
+ python-multipart>=0.0.6
17
+ jinja2>=3.1.0
18
+ markdown>=3.5.0
19
+ qrcode>=7.4.0
20
+ pillow>=10.0.0
21
+ fake-useragent>=1.4.0
22
+ cloudscraper>=1.2.71
23
+ rich>=13.7.0