Actionsync / STREAMLIT_SETUP.md
barathvasan-dev
Fix: Optional imports and database connection timeout handling
603954b
|
Raw
History Blame Contribute Delete
1.78 kB
# Streamlit Testing App - Setup Guide
## Installation
```bash
pip install streamlit gradio_client
```
## Running Locally
```bash
cd plate-detector
streamlit run streamlit_app.py
```
## Fixing API Errors
If you see errors like:
```
❌ Cannot find a function with `api_name`: /detect
❌ Cannot find a function with `api_name`: /run_query
```
### Step 1: Find Correct API Names
1. Open the sidebar and click **"Show Available APIs"** button
2. This will display all available API endpoints from your Space
3. Look for the correct function names
### Step 2: Update API Names
Edit `streamlit_app.py` and update these lines:
```python
API_NAME_DETECT = "/predict" # Change this to actual API name
API_NAME_QUERY = "/predict_1" # Change this to actual API name
```
Common patterns:
- First function: `/predict`
- Second function: `/predict_1`
- Or numbered: `/predict_0`, `/predict_1`, etc.
### Step 3: Test Again
```bash
streamlit run streamlit_app.py
```
## Features
βœ… **Detection Tab** - Upload image and detect license plate
βœ… **Query Tab** - Natural language database queries
βœ… **Analytics Tab** - View statistics and trends
βœ… **API Debugging** - Shows available endpoints and errors
## Troubleshooting
| Issue | Solution |
|-------|----------|
| `use_column_width deprecated` | βœ… Fixed - already updated to `use_container_width` |
| API not found | Click "Show Available APIs" in sidebar to see correct names |
| Connection failed | Make sure Space URL is correct: `BARATH0070/plate-detector` |
| No results | Check if HF_TOKEN and DATABASE_URL are set in your Space |
## Notes
- This is a LOCAL testing app only
- Do NOT push to HF Spaces
- Use it to test UI/UX before deploying
- Make sure your Gradio Space is running and accessible