This Flask application collects user inputs for a research design questionnaire, sends responses to a Qwen model via Ollama, and returns a structured research method report in Farsi. It also supports user registration and login with data stored in SQLite.
- Docker installed, or Python 3.10+ and pip
- Ollama server running and accessible (default
http://localhost:11434/api/chat)
Environment variables (optional, default values shown):
FLASK_SECRET: Secret key for Flask sessions (default:change-me)OLLAMA_URL: Ollama API endpoint (default:http://localhost:11434/api/chat)QUESTIONS_JSON: Path to questions JSON (default:questions.json)FLASK_HOST: Host to bind (default:0.0.0.0)FLASK_PORT: Port to bind (default:5003)FLASK_DEBUG: Debug mode flag (default:True)
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Initialize the database:
flask init-db
-
Run the application:
python run.py
-
Open a browser and navigate to
http://localhost:5003.
-
Build the Docker image:
docker build -t research-app . -
Run a container:
docker run -d --name research-app-container -p 5003:5003 research-app
-
Verify the container is running and access the app at
http://localhost:5003.
-
app/: Contains application modules and templates
__init__.py: App factory, database initializationroutes.py: Main routes for questionnaire and summaryollama_client.py: Functions to build prompt and call Ollama APIauth.py: User registration, login, logout- templates/: HTML templates for pages
-
config.py: Flask configuration class -
questions.json: JSON file defining the questions -
run.py: Entry point to start the Flask app -
requirements.txt: Python dependencies -
users.db: SQLite database file (created byflask init-db)
- Register a new user or log in with existing credentials.
- Proceed through the questionnaire pages.
- On completion, view the generated research method report.
- Log out when finished.