Pathify / HOSTING.md
Shubhambhandari's picture
Upload folder using huggingface_hub
f93c1b8 verified
|
Raw History Blame Contribute Delete
2.62 kB
# Host Pathify online for free (Hugging Face Spaces)
This gives you a public link anyone can open, no server to manage, no cost.
You will use `pathify_hfspace.zip` (the deploy bundle).
## What you need
- A free Hugging Face account: https://huggingface.co/join
- The file `pathify_hfspace.zip`, unzipped on your computer.
## Steps (about 10 minutes, most of it waiting for the build)
1. Sign in at https://huggingface.co
2. Create a Space:
- Go to https://huggingface.co/new-space
- Owner: you. Space name: `pathify`
- License: MIT
- Select the Space SDK: **Docker** → template **Blank**
- Hardware: **CPU basic** (free). Visibility: **Public**
- Click **Create Space**
3. Unzip `pathify_hfspace.zip` on your computer. You will see `Dockerfile`,
`README.md`, and the folders `backend`, `frontend`, `pathqa`, `samples`, etc.
4. Upload the files to the Space:
- On your new Space page, open the **Files** tab
- Click **Add file → Upload files**
- Drag in EVERYTHING from the unzipped folder (the `Dockerfile`, `README.md`,
and all the folders). Upload the *contents*, not the outer folder.
- Scroll down and click **Commit changes to main**
5. The Space builds itself automatically (it installs PyTorch, so the first
build takes ~5-10 minutes). Watch the status at the top:
**Building → Running**. You can click **Logs** to watch progress.
6. When it says **Running**, open the app at:
`https://<your-username>-pathify.hf.space`
Try the **Analyze image** tab and upload a sample from the `samples` folder.
## Good to know
- Free CPU Spaces "sleep" after a while of no use. The next visit wakes it in
~30 seconds. That is normal.
- On start it trains a tiny demo model (about a minute), so the first page load
after a build/wake can be slow. After that it is quick.
- It is running the DEMO model on synthetic data, so results show how it works,
not real accuracy. To make it real, train on labelled slides
(`train_pcam.py` / `finetune_from_feedback.py`) and put the resulting
`model.pt` in the Space, then set the env var `PATHQA_MODEL=model.pt` in the
Space Settings.
## Editing later
Change a file in the Space **Files** tab (or we update it here and you
re-upload). Every commit triggers an automatic rebuild, so your edits go live
on the same link.
## Faster alternative (no account, temporary)
Keep running it locally with `bash pathqa-app`, then in another terminal expose
it with a tunnel, e.g. `npx cloudflared tunnel --url http://127.0.0.1:8000`.
You get a temporary public link that lasts only while your Mac keeps it running.