diff --git a/README.md b/README.md index 538fb00..7a56758 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,12 @@ Open http://localhost:5173 to use the app. If you prefer to run the backend on a different port, update VITE_WS_BACKEND_URL in `frontend/.env.local` +For debugging purposes, if you don't want to waste GPT4-Vision credits, you can run the backend in mock mode (which streams a pre-recorded response): + +```bash +MOCK=true poetry run uvicorn main:app --reload --port 7001 +``` + ## Docker If you have Docker installed on your system, in the root directory, run: @@ -66,12 +72,10 @@ The app will be up and running at http://localhost:5173. Note that you can't dev **NYTimes** -| Original | Replica | -| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| Original | Replica | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Screenshot 2023-11-20 at 12 54 03 PM | Screenshot 2023-11-20 at 12 59 56 PM | - - **Instagram page (with not Taylor Swift pics)** https://github.com/abi/screenshot-to-code/assets/23818/503eb86a-356e-4dfc-926a-dabdb1ac7ba1 diff --git a/backend/main.py b/backend/main.py index c97067d..93d2e9a 100644 --- a/backend/main.py +++ b/backend/main.py @@ -33,7 +33,8 @@ app.add_middleware( # Useful for debugging purposes when you don't want to waste GPT4-Vision credits # Setting to True will stream a mock response instead of calling the OpenAI API -SHOULD_MOCK_AI_RESPONSE = False +# TODO: Should only be set to true when value is 'True', not any abitrary truthy value +SHOULD_MOCK_AI_RESPONSE = bool(os.environ.get("MOCK", False)) app.include_router(screenshot.router)