Spaces:
Sleeping
Sleeping
add HF Spaces config to README
Browse files
README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: DocChat Backend
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: teal
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Document Ingestion System
|
| 11 |
+
|
| 12 |
+
Upload a `.txt` or `.pdf` file and extract its text content via a FastAPI backend + Streamlit frontend.
|
| 13 |
+
|
| 14 |
+
## Folder Structure
|
| 15 |
+
|
| 16 |
+
```
|
| 17 |
+
doc_ingestion/
|
| 18 |
+
βββ backend/
|
| 19 |
+
β βββ __init__.py
|
| 20 |
+
β βββ main.py # FastAPI app & routes
|
| 21 |
+
β βββ ingestion.py # File handling & metadata
|
| 22 |
+
β βββ parser.py # Text extraction logic
|
| 23 |
+
βββ frontend/
|
| 24 |
+
β βββ app.py # Streamlit UI
|
| 25 |
+
βββ requirements.txt
|
| 26 |
+
βββ README.md
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
## Setup & Run
|
| 30 |
+
|
| 31 |
+
### 1. Install dependencies
|
| 32 |
+
|
| 33 |
+
```bash
|
| 34 |
+
cd doc_ingestion
|
| 35 |
+
pip install -r requirements.txt
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
### 2. Start the FastAPI backend (Terminal 1)
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
cd doc_ingestion
|
| 42 |
+
uvicorn backend.main:app --reload --port 8000
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
The API will be available at `http://localhost:8000`. You can also test it at `http://localhost:8000/docs`.
|
| 46 |
+
|
| 47 |
+
### 3. Start the Streamlit frontend (Terminal 2)
|
| 48 |
+
|
| 49 |
+
```bash
|
| 50 |
+
cd doc_ingestion
|
| 51 |
+
streamlit run frontend/app.py
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
The UI will open at `http://localhost:8501`.
|
| 55 |
+
|
| 56 |
+
### 4. Use it
|
| 57 |
+
|
| 58 |
+
1. Open the Streamlit UI in your browser.
|
| 59 |
+
2. Upload a `.txt` or `.pdf` file.
|
| 60 |
+
3. View the extracted text and file metadata.
|