-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_chatbot.py
More file actions
67 lines (54 loc) · 1.95 KB
/
Copy pathrun_chatbot.py
File metadata and controls
67 lines (54 loc) · 1.95 KB
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
#!/usr/bin/env python3
"""
Simple launcher for the RAG Image Search Chatbot
"""
import sys
import os
def main():
print("Starting RAG Image Search Chatbot...")
print("=" * 50)
# Check if required files exist
required_files = [
"data_downloader.py",
"data_processor.py",
"model_image_search.py",
"gemini_ranker.py"
]
missing_files = [f for f in required_files if not os.path.exists(f)]
if missing_files:
print(f"❌ Missing required files: {missing_files}")
print("Please make sure you're in the correct directory with all the RAG components.")
return
# Check if data directory exists
if not os.path.exists("data"):
print("❌ Data directory not found. Please run the main.py first to download data.")
return
print("✅ All required files found!")
try:
# Try to import and run the chatbot
print("🔧 Importing chatbot...")
from chatbot_simple import create_chatbot_interface
print("Creating chatbot interface...")
demo = create_chatbot_interface()
print("Launching chatbot...")
print("The chatbot will open in your browser at: http://localhost:7861")
print("Press Ctrl+C to stop the chatbot")
demo.launch(
share=False,
server_name="0.0.0.0",
server_port=7861,
show_error=True
)
except ImportError as e:
print(f"❌ Import error: {e}")
print("💡 Try installing dependencies with: pip install -r chatbot_requirements.txt")
except Exception as e:
print(f"❌ Error starting chatbot: {e}")
print("💡 Check the console output for more details")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n Chatbot stopped by user")
except Exception as e:
print(f"❌ Unexpected error: {e}")