Flask newspaper editor that scrapes article URLs, sends the text to a local Qwen AI server, and returns publication-ready summaries. The AI also powers contextual chat and editing endpoints so users can rewrite, expand, or insert polished article copy from the browser editor.
Newspaper AI is split into two small Flask services:
desktop_AI_server.pyruns the local AI model API using Qwen through Hugging Face Transformers.app.pyruns the browser newspaper editor, scrapes article URLs, and calls the AI server for summaries, chat, and edits.
Use the home page to paste a news article URL and generate a polished summary, or open the editor manually to write and revise article copy with AI help.
- Python 3.10 or newer
- Enough disk space to download the Qwen model on first run
- Optional but recommended: NVIDIA GPU with CUDA for faster local generation
Create and activate a virtual environment:
python -m venv venvmacOS or Linux:
source venv/bin/activateWindows PowerShell:
venv\Scripts\Activate.ps1Windows Command Prompt:
venv\Scripts\activate.batInstall the web app dependencies:
pip install -r requirements.txtInstall the desktop AI server dependencies:
pip install -r desktop_requirements.txtOpen two terminals from the project folder.
Terminal 1, start the AI server:
python desktop_AI_server.pyTerminal 2, start the newspaper web app:
python app.pyThen open this in your browser:
http://localhost:5001
The manual editor is available at:
http://localhost:5001/editor
If both services run on the same computer, start the web app with:
macOS or Linux:
AI_SERVER_URL=http://127.0.0.1:5000 python app.pyWindows PowerShell:
$env:AI_SERVER_URL="http://127.0.0.1:5000"; python app.pyWindows Command Prompt:
set AI_SERVER_URL=http://127.0.0.1:5000
python app.pyUseful environment variables:
AI_SERVER_URLsets where the web app sends AI requests. Default:http://192.168.86.243:5000APP_HOSTandAPP_PORTcontrol the web app host and port. Default:0.0.0.0:5001AI_HOSTandAI_PORTcontrol the AI server host and port. Default:0.0.0.0:5000QWEN_MODELchanges the Hugging Face model. Default:Qwen/Qwen2.5-3B-InstructMAX_NEW_TOKENScontrols response length. Default:900
app.py: browser app, article scraping, and AI request routesdesktop_AI_server.py: local Qwen model servertemplates/: Flask HTML pagesstatic/: browser JavaScript and CSSrequirements.txt: browser app Python packagesdesktop_requirements.txt: local AI server Python packages