Spaces:
Runtime error
Runtime error
CaesarCloudSync commited on
Commit ·
ea61d24
1
Parent(s): 2ebab1d
debig notecardimage urls
Browse files- __pycache__/main.cpython-310.pyc +0 -0
- main.py +4 -3
- templates/hello.html +6 -2
__pycache__/main.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/main.cpython-310.pyc and b/__pycache__/main.cpython-310.pyc differ
|
|
|
main.py
CHANGED
|
@@ -103,12 +103,12 @@ async def notecardimage(request: Request, h:str,u:str):
|
|
| 103 |
found_revision_card = find_revision_card(username,hashedvalue)
|
| 104 |
try:
|
| 105 |
revisioncarddetected = found_revision_card[0]
|
| 106 |
-
if "gif" in revisioncarddetected["revisioncardimage"][0]:
|
| 107 |
imagebyteio = io.BytesIO(base64.b64decode(re.sub("data:image/gif;base64", '', revisioncarddetected["revisioncardimage"][0])))
|
| 108 |
img_byte_arr= get_first_frame(imagebyteio)
|
| 109 |
return Response(content = img_byte_arr, media_type="image/gif")
|
| 110 |
#return Response(content = imagebyteio.read(), media_type="image/gif")
|
| 111 |
-
elif "gif" not in revisioncarddetected["revisioncardimage"][0]:
|
| 112 |
imagecv2 = readb64(revisioncarddetected["revisioncardimage"][0])
|
| 113 |
res, im_png = cv2.imencode(".png", imagecv2)
|
| 114 |
return Response(content = im_png.tobytes(), media_type="image/png")
|
|
@@ -126,4 +126,5 @@ async def main():
|
|
| 126 |
await server.serve()
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
-
|
|
|
|
|
|
| 103 |
found_revision_card = find_revision_card(username,hashedvalue)
|
| 104 |
try:
|
| 105 |
revisioncarddetected = found_revision_card[0]
|
| 106 |
+
if "data:image/gif;base64" in revisioncarddetected["revisioncardimage"][0]:
|
| 107 |
imagebyteio = io.BytesIO(base64.b64decode(re.sub("data:image/gif;base64", '', revisioncarddetected["revisioncardimage"][0])))
|
| 108 |
img_byte_arr= get_first_frame(imagebyteio)
|
| 109 |
return Response(content = img_byte_arr, media_type="image/gif")
|
| 110 |
#return Response(content = imagebyteio.read(), media_type="image/gif")
|
| 111 |
+
elif "data:image/gif;base64" not in revisioncarddetected["revisioncardimage"][0]:
|
| 112 |
imagecv2 = readb64(revisioncarddetected["revisioncardimage"][0])
|
| 113 |
res, im_png = cv2.imencode(".png", imagecv2)
|
| 114 |
return Response(content = im_png.tobytes(), media_type="image/png")
|
|
|
|
| 126 |
await server.serve()
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
+
uvicorn.run("main:app", port=7860, log_level="info",host="0.0.0.0",reload=True)
|
| 130 |
+
#asyncio.run(main())
|
templates/hello.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
| 26 |
</meta>
|
| 27 |
<meta property="og:description" content="{{subject}} | {{revisioncardtitle}}">
|
| 28 |
</meta>
|
| 29 |
-
<meta property="og:image" content="https://palondomus-
|
| 30 |
</meta>
|
| 31 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 32 |
|
|
@@ -38,7 +38,7 @@
|
|
| 38 |
</meta>
|
| 39 |
<meta property="twitter:description" content="{{subject}} | {{revisioncardtitle}}">
|
| 40 |
</meta>
|
| 41 |
-
<meta property="twitter:image" content="https://palondomus-
|
| 42 |
</meta>
|
| 43 |
<style>
|
| 44 |
a,p,h1{
|
|
@@ -82,9 +82,13 @@
|
|
| 82 |
<p >{{subject}}</p>
|
| 83 |
<p style="margin-right:40px">{{revisioncardtitle}}</p>
|
| 84 |
</div>
|
|
|
|
| 85 |
<textarea name="revisioncard" className="form-control" style="position:relative;left:-40px;height:200px;width:95%;margin-top:10px">
|
| 86 |
{{revisioncard}}
|
| 87 |
</textarea>
|
|
|
|
|
|
|
|
|
|
| 88 |
<div style="display:flex;gap:10px;margin-top:10px;">
|
| 89 |
{%for ind in range(revisioncardimgname|length)%}
|
| 90 |
<div>
|
|
|
|
| 26 |
</meta>
|
| 27 |
<meta property="og:description" content="{{subject}} | {{revisioncardtitle}}">
|
| 28 |
</meta>
|
| 29 |
+
<meta property="og:image" content="https://palondomus-revisionbankcard.hf.space/notecardimage?h={{hashvalue}}&u={{username}}">
|
| 30 |
</meta>
|
| 31 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 32 |
|
|
|
|
| 38 |
</meta>
|
| 39 |
<meta property="twitter:description" content="{{subject}} | {{revisioncardtitle}}">
|
| 40 |
</meta>
|
| 41 |
+
<meta property="twitter:image" content="https://palondomus-revisionbankcard.hf.space/notecardimage?h={{hashvalue}}&u={{username}}">
|
| 42 |
</meta>
|
| 43 |
<style>
|
| 44 |
a,p,h1{
|
|
|
|
| 82 |
<p >{{subject}}</p>
|
| 83 |
<p style="margin-right:40px">{{revisioncardtitle}}</p>
|
| 84 |
</div>
|
| 85 |
+
|
| 86 |
<textarea name="revisioncard" className="form-control" style="position:relative;left:-40px;height:200px;width:95%;margin-top:10px">
|
| 87 |
{{revisioncard}}
|
| 88 |
</textarea>
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
|
| 92 |
<div style="display:flex;gap:10px;margin-top:10px;">
|
| 93 |
{%for ind in range(revisioncardimgname|length)%}
|
| 94 |
<div>
|