Spaces:
Runtime error
Runtime error
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
<title>DeepSeek Web Builder</title> | |
<style> | |
body { | |
margin: 0; | |
font-family: 'Segoe UI', sans-serif; | |
display: flex; | |
flex-direction: column; | |
height: 100vh; | |
background: #f9f9f9; | |
} | |
.container { | |
display: flex; | |
flex: 1; | |
overflow: hidden; | |
} | |
.code-panel { | |
width: 50%; | |
background-color: #1e1e1e; | |
color: #fff; | |
padding: 10px; | |
box-sizing: border-box; | |
overflow-y: auto; | |
} | |
.code-panel pre { | |
white-space: pre-wrap; | |
word-wrap: break-word; | |
} | |
.preview-panel { | |
width: 50%; | |
background: #fff; | |
border-left: 2px solid #ddd; | |
} | |
iframe { | |
width: 100%; | |
height: 100%; | |
border: none; | |
} | |
.input-bar { | |
display: flex; | |
padding: 10px; | |
border-top: 1px solid #ccc; | |
background: #fff; | |
} | |
.input-bar input { | |
flex: 1; | |
padding: 10px; | |
font-size: 16px; | |
border: 1px solid #ccc; | |
border-radius: 6px; | |
} | |
.input-bar button { | |
padding: 10px 20px; | |
margin-left: 10px; | |
background-color: #ff2b82; | |
color: white; | |
border: none; | |
border-radius: 6px; | |
cursor: pointer; | |
} | |
h2 { | |
margin-top: 10px; | |
color: #999; | |
font-weight: 400; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="code-panel"> | |
<h2>Generated Code</h2> | |
<pre id="codeDisplay">Waiting for your prompt...</pre> | |
</div> | |
<div class="preview-panel"> | |
<iframe id="previewFrame"></iframe> | |
</div> | |
</div> | |
<div class="input-bar"> | |
<input type="text" id="userInput" placeholder="β¨ Ask me to create a modern, animated website or app..." /> | |
<button onclick="sendPrompt()">β€</button> | |
</div> | |
<script> | |
function sendPrompt() { | |
const prompt = document.getElementById("userInput").value; | |
fetch("/generate", { | |
method: "POST", | |
headers: { "Content-Type": "application/json" }, | |
body: JSON.stringify({ prompt: prompt }) | |
}) | |
.then(res => res.json()) | |
.then(data => { | |
document.getElementById("codeDisplay").textContent = data.code; | |
const blob = new Blob([data.code], { type: "text/html" }); | |
document.getElementById("previewFrame").src = URL.createObjectURL(blob); | |
}); | |
} | |
</script> | |
</body> | |
</html> | |