Skip to content

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

Python

clean up

Abi Raja47c0085e69a0
diff --git a/backend/prompts/__init__.py b/backend/prompts/__init__.py
index e8553aa6..eeefe4db 100644
--- a/backend/prompts/__init__.py
+++ b/backend/prompts/__init__.py
@@ -5,7 +5,7 @@ from custom_types import InputMode
from prompts.imported_code_prompts import IMPORTED_CODE_SYSTEM_PROMPTS
from prompts.screenshot_system_prompts import SYSTEM_PROMPT
from prompts.text_prompts import SYSTEM_PROMPTS as TEXT_SYSTEM_PROMPTS
-from prompts.claude_prompts import GEMINI_VIDEO_PROMPT
+from prompts.video_prompts import GEMINI_VIDEO_PROMPT
from prompts.types import Stack, PromptContent
diff --git a/backend/prompts/claude_prompts.py b/backend/prompts/claude_prompts.py
deleted file mode 100644
index ff9be2b0..00000000
--- a/backend/prompts/claude_prompts.py
+++ /dev/null
@@ -1,87 +0,0 @@
-GEMINI_VIDEO_PROMPT = """
-You are an expert at building single page, functional apps using HTML, jQuery and Tailwind CSS.
-You also have perfect vision and pay great attention to detail.
-
-You will be given a video of a user interacting with a web app. You need to re-create the same app exactly such that the same user interactions will produce the same results in the app you build.
-
-- Watch the entire video carefully and understand all the user interactions and UI state changes.
-- Make sure the app looks exactly like what you see in the video.
-- Pay close attention to background color, text color, font size, font family,
-padding, margin, border, etc. Match the colors and sizes exactly.
-- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
-- Put image URLs in HTML (hide / unhide as needed). Do not put image URLs within JavaScript because our parser cannot extract them from JavaScript.
-- If some functionality requires a backend call, just mock the data instead.
-- MAKE THE APP FUNCTIONAL using JavaScript. Allow the user to interact with the app and get the same behavior as shown in the video.
-- Use SVGs and interactive 3D elements if needed to match the functionality shown in the video.
-
-In terms of libraries,
-
-- Use this script to include Tailwind: <script src="https://cdn.tailwindcss.com"></script>
-- You can use Google Fonts
-- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
-- Use jQuery: <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
-
-"""
-
-
-HTML_TAILWIND_CLAUDE_SYSTEM_PROMPT = """
-You have perfect vision and pay great attention to detail which makes you an expert at building single page apps using Tailwind, HTML and JS.
-You take screenshots of a reference web page from the user, and then build single page apps
-using Tailwind, HTML and JS.
-You might also be given a screenshot (The second image) of a web page that you have already built, and asked to
-update it to look more like the reference image(The first image).
-
-- Make sure the app looks exactly like the screenshot.
-- Do not leave out smaller UI elements. Make sure to include every single thing in the screenshot.
-- Pay close attention to background color, text color, font size, font family,
-padding, margin, border, etc. Match the colors and sizes exactly.
-- In particular, pay attention to background color and overall color scheme.
-- Use the exact text from the screenshot.
-- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.
-- Make sure to always get the layout right (if things are arranged in a row in the screenshot, they should be in a row in the app as well)
-- Repeat elements as needed to match the screenshot. For example, if there are 15 items, the code should have 15 items. DO NOT LEAVE comments like "<!-- Repeat for each news item -->" or bad things will happen.
-- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
-
-In terms of libraries,
-
-- Use this script to include Tailwind: <script src="https://cdn.tailwindcss.com"></script>
-- You can use Google Fonts
-- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
-
-Return only the full code in <html></html> tags.
-Do not include markdown "```" or "```html" at the start or end.
-"""
-
-#
-
-REACT_TAILWIND_CLAUDE_SYSTEM_PROMPT = """
-You have perfect vision and pay great attention to detail which makes you an expert at building single page apps using React/Tailwind.
-You take screenshots of a reference web page from the user, and then build single page apps
-using React and Tailwind CSS.
-You might also be given a screenshot (The second image) of a web page that you have already built, and asked to
-update it to look more like the reference image(The first image).
-
-- Make sure the app looks exactly like the screenshot.
-- Do not leave out smaller UI elements. Make sure to include every single thing in the screenshot.
-- Pay close attention to background color, text color, font size, font family,
-padding, margin, border, etc. Match the colors and sizes exactly.
-- In particular, pay attention to background color and overall color scheme.
-- Use the exact text from the screenshot.
-- Do not add comments in the code such as "<!-- Add other navigation links as needed -->" and "<!-- ... other news items ... -->" in place of writing the full code. WRITE THE FULL CODE.
-- Make sure to always get the layout right (if things are arranged in a row in the screenshot, they should be in a row in the app as well)
-- CREATE REUSABLE COMPONENTS FOR REPEATING ELEMENTS. For example, if there are 15 similar items in the screenshot, your code should include a reusable component that generates these items. and use loops to instantiate these components as needed.
-- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
-
-In terms of libraries,
-
-- Use these script to include React so that it can run on a standalone page:
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/umd/react.development.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.development.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/@babel/standalone/babel.js"></script>
-- Use this script to include Tailwind: <script src="https://cdn.tailwindcss.com"></script>
-- You can use Google Fonts
-- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
-
-Return only the full code in <html></html> tags.
-Do not include markdown "```" or "```html" at the start or end.
-"""
diff --git a/backend/prompts/video_prompts.py b/backend/prompts/video_prompts.py
new file mode 100644
index 00000000..97fa93ae
--- /dev/null
+++ b/backend/prompts/video_prompts.py
@@ -0,0 +1,24 @@
+GEMINI_VIDEO_PROMPT = """
+You are an expert at building single page, functional apps using HTML, jQuery and Tailwind CSS.
+You also have perfect vision and pay great attention to detail.
+
+You will be given a video of a user interacting with a web app. You need to re-create the same app exactly such that the same user interactions will produce the same results in the app you build.
+
+- Watch the entire video carefully and understand all the user interactions and UI state changes.
+- Make sure the app looks exactly like what you see in the video.
+- Pay close attention to background color, text color, font size, font family,
+padding, margin, border, etc. Match the colors and sizes exactly.
+- For images, use placeholder images from https://placehold.co and include a detailed description of the image in the alt text so that an image generation AI can generate the image later.
+- Put image URLs in HTML (hide / unhide as needed). Do not put image URLs within JavaScript because our parser cannot extract them from JavaScript.
+- If some functionality requires a backend call, just mock the data instead.
+- MAKE THE APP FUNCTIONAL using JavaScript. Allow the user to interact with the app and get the same behavior as shown in the video.
+- Use SVGs and interactive 3D elements if needed to match the functionality shown in the video.
+
+In terms of libraries,
+
+- Use this script to include Tailwind: <script src="https://cdn.tailwindcss.com"></script>
+- You can use Google Fonts
+- Font Awesome for icons: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"></link>
+- Use jQuery: <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
+
+"""
diff --git a/backend/routes/generate_code.py b/backend/routes/generate_code.py
index 482d674a..1c85fcbc 100644
--- a/backend/routes/generate_code.py
+++ b/backend/routes/generate_code.py
@@ -414,28 +414,28 @@ class ModelSelectionStage:
"Video mode requires a Gemini API key. "
"Please add GEMINI_API_KEY to backend/.env or in the settings dialog"
)
- return [Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL, Llm.GEMINI_3_PRO_PREVIEW_HIGH]
+ return [Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL, Llm.GEMINI_3_PRO_PREVIEW_LOW]
# Define models based on available API keys
if gemini_api_key and anthropic_api_key and openai_api_key:
models = [
- Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
- Llm.GEMINI_3_PRO_PREVIEW_HIGH,
+ Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
+ Llm.GEMINI_3_PRO_PREVIEW_LOW,
Llm.CLAUDE_OPUS_4_6,
Llm.GPT_5_2_CODEX_HIGH,
]
elif gemini_api_key and anthropic_api_key:
models = [
+ Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
+ Llm.GEMINI_3_PRO_PREVIEW_LOW,
Llm.CLAUDE_OPUS_4_6,
Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
- Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
Llm.GEMINI_3_PRO_PREVIEW_HIGH,
- Llm.GEMINI_3_PRO_PREVIEW_LOW,
]
elif gemini_api_key and openai_api_key:
models = [
- Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
- Llm.GEMINI_3_PRO_PREVIEW_HIGH,
+ Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
+ Llm.GEMINI_3_PRO_PREVIEW_LOW,
Llm.GPT_5_2_CODEX_HIGH,
Llm.GPT_5_2_CODEX_MEDIUM,
]
@@ -447,10 +447,10 @@ class ModelSelectionStage:
]
elif gemini_api_key:
models = [
- Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
- Llm.GEMINI_3_PRO_PREVIEW_HIGH,
Llm.GEMINI_3_PRO_PREVIEW_LOW,
+ Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
+ Llm.GEMINI_3_PRO_PREVIEW_HIGH,
]
elif anthropic_api_key:
models = [Llm.CLAUDE_OPUS_4_6, Llm.CLAUDE_4_5_SONNET_2025_09_29]
diff --git a/backend/tests/test_model_selection.py b/backend/tests/test_model_selection.py
index a9abd940..c72b2d68 100644
--- a/backend/tests/test_model_selection.py
+++ b/backend/tests/test_model_selection.py
@@ -14,7 +14,7 @@ class TestModelSelectionAllKeys:
@pytest.mark.asyncio
async def test_gemini_anthropic_create(self):
- """All keys: Claude Opus 4.6, GPT 5.2 Codex (high), Gemini 3 Flash (high), Gemini 3 Pro (high)"""
+ """All keys: first two options are Gemini 3 Flash (minimal) and Gemini 3 Pro (low)."""
models = await self.model_selector.select_models(
generation_type="create",
input_mode="text",
@@ -24,8 +24,8 @@ class TestModelSelectionAllKeys:
)
expected = [
- Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
- Llm.GEMINI_3_PRO_PREVIEW_HIGH,
+ Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
+ Llm.GEMINI_3_PRO_PREVIEW_LOW,
Llm.CLAUDE_OPUS_4_6,
Llm.GPT_5_2_CODEX_HIGH,
]
@@ -43,13 +43,30 @@ class TestModelSelectionAllKeys:
)
expected = [
- Llm.GEMINI_3_FLASH_PREVIEW_HIGH,
- Llm.GEMINI_3_PRO_PREVIEW_HIGH,
+ Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
+ Llm.GEMINI_3_PRO_PREVIEW_LOW,
Llm.CLAUDE_OPUS_4_6,
Llm.GPT_5_2_CODEX_HIGH,
]
assert models == expected
+ @pytest.mark.asyncio
+ async def test_video_create_prefers_gemini_minimal_then_low(self):
+ """Video create always uses two Gemini variants in fixed order."""
+ models = await self.model_selector.select_models(
+ generation_type="create",
+ input_mode="video",
+ openai_api_key="key",
+ anthropic_api_key="key",
+ gemini_api_key="key",
+ )
+
+ expected = [
+ Llm.GEMINI_3_FLASH_PREVIEW_MINIMAL,
+ Llm.GEMINI_3_PRO_PREVIEW_LOW,
+ ]
+ assert models == expected
+
class TestModelSelectionOpenAIAnthropic:
"""Test model selection when only OpenAI and Anthropic keys are present."""