Spaces:
Sleeping
Sleeping
Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
|
4 |
+
# Ensure preprocess.py is in the same directory
|
5 |
+
sys.path.append(os.path.dirname(__file__))
|
6 |
+
|
7 |
+
# Import preprocess function
|
8 |
+
from preprocess import preprocess
|
9 |
+
|
10 |
+
# Check if precomputed files exist and run preprocessing if needed
|
11 |
+
if not (os.path.exists("chunks.pkl") and os.path.exists("index.faiss")):
|
12 |
+
print("Precomputed files missing. Running preprocess.py...")
|
13 |
+
preprocess()
|
14 |
+
else:
|
15 |
+
print("Precomputed files found. Skipping preprocessing.")
|
16 |
+
|
17 |
+
# Import and run app.py
|
18 |
+
print("Starting app.py...")
|
19 |
+
from app import demo
|
20 |
+
demo.launch()
|