Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

feat: add MOCK env variable for debugging purposes

vagusxba9aa5504175
diff --git a/README.md b/README.md
index a6dfabc8..9337a40f 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,9 @@ echo "OPENAI_API_KEY=sk-your-key" > .env
poetry install
poetry shell
poetry run uvicorn main:app --reload --port 7001
+
+# Useful for debugging purposes when you don't want to waste GPT4-Vision credits
+MOCK=true poetry run uvicorn main:app --reload --port 7001
```
Run the frontend:
diff --git a/backend/main.py b/backend/main.py
index 72b4dd7a..1dc93330 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -33,7 +33,7 @@ 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
+SHOULD_MOCK_AI_RESPONSE = os.environ.get("MOCK", False)
app.include_router(screenshot.router)