-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
57 lines (57 loc) · 2.59 KB
/
index.html
File metadata and controls
57 lines (57 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BLACKPINK MAKER</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css">
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
- pillow
</py-env>
<py-script>
import asyncio
async def start():
from pyodide.http import pyfetch
from js import console
from io import BytesIO
neh = await pyfetch('https://files.pythonhosted.org/packages/a2/1d/c306f8e80d51d9bb04043284d518720d51d5af26a087ccf6ce58c4887024/blackpink-0.6.1.tar.gz')
await neh.unpack_archive()
sys.path.insert(0, __import__('os').getcwd()+'/blackpink-0.6.1')
import blackpink
def onchange(e):
s = BytesIO()
blackpink.blackpink(e.target.value).save(s, format='png')
document.getElementById('output').setAttribute('src', 'data:image/jpeg;base64,'+base64.b64encode(s.getvalue()).decode())
document.getElementById('footer').style=''
def download(e):
aEl = document.createElement('a')
aEl.href = document.getElementById('output').src
aEl.download = 'blackpink.jpg'
aEl.click()
document.getElementById('teks').onkeyup = onchange
document.getElementById('download').onclick = download
loop = asyncio.get_event_loop()
loop.run_until_complete(start())
</py-script>
</head>
<body>
<div class="row mt-3">
<div class="col-10 offset-1">
<div class="card">
<div class="card-title mt-2"><h1 class="text-center">BLACKPINK</h1></div>
<div class="card-body">
<input type="text" id="teks" class="form-control" placeholder="Teks" aria-label="Teks" aria-describedby="basic-addon1">
<img id="output" width="100%">
</div>
<div class="card-footer" style="display: none;" id="footer">
<button type="button" class="btn btn-primary" id="download">Download</button>
</div>
</div>
</div>
</div>
</body>
</html>