# 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