跳到正文
DEV Community· Ujjwal Gupta·· 3 小時前AI 評分44

RailBreaker:本地開源 AI 規劃工具,將印度長途火車旅程拆分為可逐段確認座位的行程

RailBreaker: a local, open-source AI planner for breaking a long Indian train journey into confirmed-seat hops

AI 導讀

RailBreaker 是一款本地開源 AI 規劃工具,可把印度長途火車行程拆成 1 至 3 段,並按比最快直達列車多出的時間、估算票價、車廂等級和轉車等候風險排序。它以 Gemma 3 經 Ollama 處理語言和座位狀態截圖,路線搜尋及計算則由確定性 Python 程式負責。工具不查即時座位,使用約 2016 年的舊數據集,票價屬估算;分開購票不受首程列車延誤保障。

正文

Ujjwal Gupta

What I built

I live in Mumbai. Home is Lucknow, about 24 hours away by train. A flight is out of budget and the direct train is almost always waitlisted. So I end up trying combinations by hand: "Mumbai → Bhopal tonight, then Bhopal → Lucknow tomorrow?" IRCTC only searches direct trains, and nothing lists the break-journey options for you.

RailBreaker lists every schedule-feasible way to make the trip in 1 to 3 separate sittings. It ranks them by extra time over the fastest direct train, estimated fare, class and layover risk. Each plan ends in a copy-paste IRCTC checklist, so I only check seats on a short list instead of guessing.

It covers combinations I could never enumerate by hand:

  • different break stations (Nagpur, Bhopal, Itarsi, Jhansi, Kanpur...)
  • the same train booked as two tickets, which adds zero extra time and often fixes a waitlisted full journey
  • switching between stations of one city (Dadar ↔ LTT) and nearby destinations with a road leg

Demo

the Plan tab

Code: https://github.com/heyujjwal/p5y-pathify

The open-source stack

Piece What it does
Gemma 3 via Ollama (open weights, runs on my laptop) understands trips typed in English, Hindi or Hinglish, turns "via MP, no night layovers, 3AC or better" into filters, explains trade-offs, and reads availability screenshots
DataMeet railways dataset (open data) stations, trains and schedules
Python + Streamlit the engine and the UI

The routing is deterministic Python (a pruned search over a timetable graph). The model only handles language and reading. It never does the routing or the arithmetic, so it can't invent a train.

Why open innovation mattered here

  • Private and offline. My trips and my IRCTC screenshots never leave my laptop. Gemma runs locally through Ollama.
  • Free to run. There is no per-query API bill, so the tool can stay free for students and people on a tight budget. A closed API would charge per request, which breaks the business for exactly the people who need this.
  • Swappable and tunable. I can change the model (Gemma, Qwen, Llama) with one environment variable. I can also fine-tune a small model on Hinglish travel phrasing, which a general API handles poorly.
  • No lock-in on data. Open timetable data means I can fix a wrong train or add days-of-run myself, instead of waiting for a vendor.
  • Honest split of work. Using a small local model only where language is involved kept it fast on a laptop and kept the numbers trustworthy.

Would anyone pay for this?

Possible ways to charge (these are ideas I haven't tested with customers):

  • a small yearly pass for students and migrants who travel home during festival season
  • a version for relocation companies and PG operators to give newcomers
  • a "waitlist predictor" add-on trained on user-reported outcomes

What it does not do (read this)

  • It plans possible journeys. It does not know live seat availability and never touches IRCTC. You check the listed legs yourself, or paste the screenshot back so the local model marks plans Verified or Blocked.
  • The free dataset is an old snapshot (around 2016) with no days-of-run, so trains default to daily. I added a days-file override and a validator that prints direct trains to compare with IRCTC.
  • Fares are estimates.
  • Separate tickets are not protected if the first train runs late.

Try it

git clone https://github.com/heyujjwal/p5y-pathify.git
cd railbreaker
pip install -r requirements.txt
ollama pull gemma3:4b
python scripts/build_real_data.py --download --from Mumbai --to Lucknow
streamlit run app.py

The README has a step-by-step build guide and a one-page use-case doc.

來源:DEV Community · dev.to