anhkhoiphan commited on
Commit
6381fc9
·
1 Parent(s): 7d62eaf

Revert "Thử comment phần processing"

Browse files

This reverts commit 7d62eafe954d24340518f9f6bb0fcc2730bd3116.

Files changed (2) hide show
  1. app.py +50 -53
  2. requirements.txt +4 -4
app.py CHANGED
@@ -5,76 +5,73 @@ import gradio as gr
5
 
6
  # Import your interfaces
7
  from data_indexing import create_indexing_interface
8
- # from data_processing import create_processing_interface
9
 
10
- # def create_combined_app():
11
- # """Create combined app with two tabs"""
12
 
13
- # with gr.Blocks(
14
- # title="Rạng Đông Data Management System",
15
- # theme=gr.themes.Soft()
16
- # ) as app:
17
 
18
- # gr.Markdown("""
19
- # # 🏢 Rạng Đông Data Management System
20
 
21
- # Hệ thống quản lý dữ liệu sản phẩm và giải pháp của Rạng Đông
22
- # """)
23
 
24
- # with gr.Tabs() as tabs:
25
- # # Tab 1: Vector Indexing (MongoDB to Qdrant)
26
- # with gr.Tab("🗄️ Vector Indexing", id="indexing"):
27
- # gr.Markdown("""
28
- # ## Indexing dữ liệu từ MongoDB lên Qdrant
29
 
30
- # Tạo vector embeddings và index dữ liệu từ MongoDB lên Qdrant Vector Database
31
- # """)
32
 
33
- # # Create indexing interface
34
- # indexing_interface = create_indexing_interface()
35
 
36
- # # Tab 2: Data Processing (Excel to MongoDB)
37
- # with gr.Tab("📊 Data Processing", id="processing"):
38
- # gr.Markdown("""
39
- # ## Xử lý dữ liệu từ Excel lên MongoDB
40
 
41
- # Upload file Excel, xử lý dữ liệu sản phẩm và đẩy lên MongoDB Atlas
42
- # """)
43
 
44
- # # Create processing interface
45
- # processing_interface = create_processing_interface()
46
 
47
 
48
 
49
- # gr.Markdown("""
50
- # ---
51
- # ### 📖 Hướng dẫn sử dụng
52
 
53
- # **Bước 1: Data Processing**
54
- # 1. Upload file Excel chứa dữ liệu sản phẩm (product_Metadata.xlsx)
55
- # 2. Cấu hình MongoDB connection string, database name và test connection
56
- # 3. Chọn loại sản phẩm hoặc xử lý tất cả.
57
 
58
- # **Bước 2: Vector Indexing**
59
- # 1. Chọn collection cần indexing
60
- # 2. Hệ thống sẽ tạo embeddings và đẩy lên Qdrant
61
 
62
- # """)
63
 
64
- # return app
65
 
66
 
67
- # if __name__ == "__main__":
68
- # app = create_combined_app()
69
 
70
- # # Launch with appropriate settings for Hugging Face Spaces
71
- # app.launch(
72
- # server_name="0.0.0.0", # Required for HF Spaces
73
- # server_port=7860, # Default HF Spaces port
74
- # share=False, # Don't need share link on HF Spaces
75
- # show_error=True,
76
- # debug=False
77
- # )
78
-
79
- demo = create_indexing_interface()
80
- demo.launch()
 
5
 
6
  # Import your interfaces
7
  from data_indexing import create_indexing_interface
8
+ from data_processing import create_processing_interface
9
 
10
+ def create_combined_app():
11
+ """Create combined app with two tabs"""
12
 
13
+ with gr.Blocks(
14
+ title="Rạng Đông Data Management System",
15
+ theme=gr.themes.Soft()
16
+ ) as app:
17
 
18
+ gr.Markdown("""
19
+ # 🏢 Rạng Đông Data Management System
20
 
21
+ Hệ thống quản lý dữ liệu sản phẩm và giải pháp của Rạng Đông
22
+ """)
23
 
24
+ with gr.Tabs() as tabs:
25
+ # Tab 1: Vector Indexing (MongoDB to Qdrant)
26
+ with gr.Tab("🗄️ Vector Indexing", id="indexing"):
27
+ gr.Markdown("""
28
+ ## Indexing dữ liệu từ MongoDB lên Qdrant
29
 
30
+ Tạo vector embeddings và index dữ liệu từ MongoDB lên Qdrant Vector Database
31
+ """)
32
 
33
+ # Create indexing interface
34
+ indexing_interface = create_indexing_interface()
35
 
36
+ # Tab 2: Data Processing (Excel to MongoDB)
37
+ with gr.Tab("📊 Data Processing", id="processing"):
38
+ gr.Markdown("""
39
+ ## Xử lý dữ liệu từ Excel lên MongoDB
40
 
41
+ Upload file Excel, xử lý dữ liệu sản phẩm và đẩy lên MongoDB Atlas
42
+ """)
43
 
44
+ # Create processing interface
45
+ processing_interface = create_processing_interface()
46
 
47
 
48
 
49
+ gr.Markdown("""
50
+ ---
51
+ ### 📖 Hướng dẫn sử dụng
52
 
53
+ **Bước 1: Data Processing**
54
+ 1. Upload file Excel chứa dữ liệu sản phẩm (product_Metadata.xlsx)
55
+ 2. Cấu hình MongoDB connection string, database name và test connection
56
+ 3. Chọn loại sản phẩm hoặc xử lý tất cả.
57
 
58
+ **Bước 2: Vector Indexing**
59
+ 1. Chọn collection cần indexing
60
+ 2. Hệ thống sẽ tạo embeddings và đẩy lên Qdrant
61
 
62
+ """)
63
 
64
+ return app
65
 
66
 
67
+ if __name__ == "__main__":
68
+ app = create_combined_app()
69
 
70
+ # Launch with appropriate settings for Hugging Face Spaces
71
+ app.launch(
72
+ server_name="0.0.0.0", # Required for HF Spaces
73
+ server_port=7860, # Default HF Spaces port
74
+ share=False, # Don't need share link on HF Spaces
75
+ show_error=True,
76
+ debug=False
77
+ )
 
 
 
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- torch
2
  transformers
3
  sentence-transformers
4
  FlagEmbedding
@@ -9,6 +9,6 @@ pymongo
9
  Pillow
10
  requests
11
  gradio
12
- # python-dotenv
13
- # docling
14
- # openpyxl
 
1
+ # torch
2
  transformers
3
  sentence-transformers
4
  FlagEmbedding
 
9
  Pillow
10
  requests
11
  gradio
12
+ python-dotenv
13
+ docling
14
+ openpyxl