-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.bat
More file actions
211 lines (189 loc) · 4.66 KB
/
run.bat
File metadata and controls
211 lines (189 loc) · 4.66 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
@echo off
:: Biomedical Research Assistant - Windows Batch Runner
:: This script helps you run the system easily on Windows
setlocal
echo =====================================
echo Biomedical Research Assistant
echo =====================================
echo.
:: Check if Python is available
python --version >nul 2>&1
if errorlevel 1 (
echo ERROR: Python is not installed or not in PATH
echo Please install Python 3.8+ from https://python.org
pause
exit /b 1
)
:: Check if virtual environment exists
if not exist "venv\" (
echo Virtual environment not found. Creating one...
python -m venv venv
if errorlevel 1 (
echo ERROR: Failed to create virtual environment
pause
exit /b 1
)
echo Virtual environment created successfully.
echo.
)
:: Activate virtual environment
call venv\Scripts\activate
if errorlevel 1 (
echo ERROR: Failed to activate virtual environment
pause
exit /b 1
)
:: Check if requirements are installed
if not exist "venv\Lib\site-packages\fastapi" (
echo Installing requirements...
echo This may take 10-15 minutes on first run...
pip install -r requirements.txt
if errorlevel 1 (
echo ERROR: Failed to install requirements
pause
exit /b 1
)
echo Requirements installed successfully.
echo.
)
:: Check configuration
if not exist ".env" (
echo Configuration file not found.
if exist ".env.template" (
copy .env.template .env >nul
echo .env file created from template.
echo IMPORTANT: Please edit .env file and set your email address!
echo.
echo Opening .env file in notepad...
start notepad .env
echo After editing .env, press any key to continue...
pause >nul
) else (
echo ERROR: .env.template not found
pause
exit /b 1
)
)
:: Main menu
:menu
echo.
echo What would you like to do?
echo.
echo 1. Check configuration
echo 2. Setup system (first time setup - may take 30-60 minutes)
echo 3. Start API server
echo 4. Start web dashboard
echo 5. Run search demo
echo 6. Run summarization demo
echo 7. Run topic analysis demo
echo 8. Start both server and dashboard
echo 9. Exit
echo.
set /p choice="Enter your choice (1-9): "
if "%choice%"=="1" goto check
if "%choice%"=="2" goto setup
if "%choice%"=="3" goto server
if "%choice%"=="4" goto dashboard
if "%choice%"=="5" goto demo_search
if "%choice%"=="6" goto demo_summary
if "%choice%"=="7" goto demo_topics
if "%choice%"=="8" goto both
if "%choice%"=="9" goto exit
goto menu
:check
echo.
echo Checking configuration...
python main.py check
if errorlevel 1 (
echo Configuration check failed. Please check your .env file.
) else (
echo Configuration check passed!
)
echo.
pause
goto menu
:setup
echo.
echo Starting system setup...
echo This will:
echo - Download research papers from PubMed
echo - Process and analyze the data
echo - Create AI embeddings and indexes
echo - Set up topic models
echo.
echo This may take 30-60 minutes depending on your settings.
set /p confirm="Continue? (y/n): "
if /i not "%confirm%"=="y" goto menu
echo.
echo Starting setup...
python main.py setup
if errorlevel 1 (
echo Setup failed. Please check the error messages above.
) else (
echo Setup completed successfully!
echo You can now start the server and dashboard.
)
echo.
pause
goto menu
:server
echo.
echo Starting API server...
echo API will be available at: http://localhost:8000
echo API documentation at: http://localhost:8000/docs
echo Press Ctrl+C to stop the server
echo.
python main.py server
goto menu
:dashboard
echo.
echo Starting web dashboard...
echo Dashboard will be available at: http://localhost:8501
echo Press Ctrl+C to stop the dashboard
echo.
python main.py dashboard
goto menu
:demo_search
echo.
echo Running search demonstration...
python main.py demo-search
echo.
pause
goto menu
:demo_summary
echo.
echo Running summarization demonstration...
python main.py demo-summary
echo.
pause
goto menu
:demo_topics
echo.
echo Running topic analysis demonstration...
python main.py demo-topics
echo.
pause
goto menu
:both
echo.
echo Starting both API server and web dashboard...
echo.
echo Starting API server in background...
start /b python main.py server
:: Wait a moment for server to start
timeout /t 5 /nobreak >nul
echo Starting web dashboard...
echo Dashboard will be available at: http://localhost:8501
echo API will be available at: http://localhost:8000
echo.
echo Press Ctrl+C to stop
python main.py dashboard
:: Clean up background process
taskkill /f /im python.exe /fi "WINDOWTITLE eq *main.py server*" >nul 2>&1
goto menu
:exit
echo.
echo Thanks for using Biomedical Research Assistant!
echo.
pause
exit /b 0