Spaces:
Build error
Build error
Commit ·
5e6d0bb
1
Parent(s): fe17a6f
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
|
|
| 1 |
from numpy.core.records import record
|
| 2 |
-
import streamlit as st
|
| 3 |
-
st.set_page_config(
|
| 4 |
-
page_title="Game Keys",
|
| 5 |
-
page_icon="🎮",
|
| 6 |
-
layout="wide",
|
| 7 |
-
initial_sidebar_state="expanded"
|
| 8 |
-
)
|
| 9 |
import pandas as pd
|
| 10 |
import numpy as np
|
| 11 |
import cv2
|
|
@@ -13,6 +7,17 @@ import mediapipe as mp
|
|
| 13 |
import time
|
| 14 |
from PIL import Image
|
| 15 |
import tempfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
DEMO_IMAGE = 'demo.jpg'
|
| 18 |
DEMO_VIDEO = 'test3.mp4'
|
|
@@ -20,19 +25,9 @@ prevTime=0
|
|
| 20 |
currTime=0
|
| 21 |
tipIds= [4,8,12,16,20]
|
| 22 |
st.title('Game Keys with Hand Tracking Web-App')
|
| 23 |
-
import webbrowser
|
| 24 |
-
|
| 25 |
url = 'https://github.com/shashankanand13monu/Game-Automation'
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
# webbrowser.open_new_tab(url)
|
| 29 |
-
|
| 30 |
-
# st.set_page_config(
|
| 31 |
-
# page_title="Ex-stream-ly Cool App",
|
| 32 |
-
# page_icon="🧊",
|
| 33 |
-
# layout="wide",
|
| 34 |
-
# initial_sidebar_state="expanded"
|
| 35 |
-
# )
|
| 36 |
|
| 37 |
mp_drawing = mp.solutions.drawing_utils
|
| 38 |
mp_draw= mp.solutions.drawing_utils
|
|
@@ -40,32 +35,15 @@ mp_face_mesh = mp.solutions.face_mesh
|
|
| 40 |
mp_draw= mp.solutions.drawing_utils
|
| 41 |
mp_hand= mp.solutions.hands
|
| 42 |
mp_hands = mp.solutions.hands
|
| 43 |
-
# mp_drawing = mp.solutions.drawing_utils
|
| 44 |
mp_drawing_styles = mp.solutions.drawing_styles
|
| 45 |
-
|
| 46 |
-
#
|
| 47 |
-
|
| 48 |
-
# mp_drawing_styles = mp.solutions.drawing_styles
|
| 49 |
-
# mp_hands = mp.solutions.hands
|
| 50 |
t = st.empty()
|
| 51 |
def draw(str):
|
| 52 |
-
# t.subheader(str)
|
| 53 |
-
# original_title = 'f<p style="font-family:Arial Black; color:red; font-size: 30px;">{str}</p>'
|
| 54 |
-
# st.markdown('f<p style="font-family:Arial Black; color:red; font-size: 30px;">{str}</p>', unsafe_allow_html=True)
|
| 55 |
t.markdown(f'<p style="font-family:Arial Black;color:#FF0686;font-size:28px;;">{str}</p>', unsafe_allow_html=True)
|
| 56 |
-
# variable_output = str
|
| 57 |
-
# font_size = 30
|
| 58 |
-
|
| 59 |
-
# html_str = f"""
|
| 60 |
-
# <style>
|
| 61 |
-
# p.a {{
|
| 62 |
-
# font: bold {font_size}px Courier;
|
| 63 |
-
# }}
|
| 64 |
-
# </style>
|
| 65 |
-
# <p class="a">{variable_output}</p>
|
| 66 |
-
# """
|
| 67 |
|
| 68 |
-
#
|
| 69 |
|
| 70 |
st.markdown(
|
| 71 |
"""
|
|
@@ -78,13 +56,23 @@ width: 350px
|
|
| 78 |
margin-left: -350px
|
| 79 |
</style>
|
| 80 |
""",unsafe_allow_html=True,)
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
|
|
|
| 85 |
st.sidebar.subheader('Settings')
|
| 86 |
|
|
|
|
| 87 |
@st.cache ()
|
|
|
|
|
|
|
| 88 |
def image_resize(image, width=None, height=None, inter =cv2.INTER_AREA):
|
| 89 |
|
| 90 |
dim = None
|
|
@@ -100,15 +88,12 @@ def image_resize(image, width=None, height=None, inter =cv2.INTER_AREA):
|
|
| 100 |
#resize the image
|
| 101 |
resized =cv2.resize(image, dim ,interpolation=inter)
|
| 102 |
return resized
|
|
|
|
| 103 |
|
| 104 |
app_mode= st.sidebar.selectbox('Choose the App Mode',
|
| 105 |
-
['About App','Run on Image','Run On Video'])
|
| 106 |
|
| 107 |
-
#
|
| 108 |
-
# st.sidebar.button('Code')
|
| 109 |
-
# st.sibutton('Code')
|
| 110 |
-
# if st.sidebar.button('Code'):
|
| 111 |
-
# webbrowser.open_new_tab(url)
|
| 112 |
|
| 113 |
if app_mode== 'About App':
|
| 114 |
st.markdown('App Made using **Mediapipe** & **Open CV**')
|
|
@@ -139,14 +124,26 @@ if app_mode== 'About App':
|
|
| 139 |
st.image('wsad.jpg',width=200)
|
| 140 |
original_title = '<pre style="font-family:Aku & Kamu; color:#FD0101 ; font-size: 28px;font-weight:Bold">*NOTE</pre>'
|
| 141 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 142 |
-
original_title= '''<pre style="font-family:Aku & Kamu; color:#
|
| 143 |
Video Option will Experience Lag in Browsers.
|
| 144 |
If It's <strong>Lagging</strong> just <strong>Reload</strong> & Choose your option <strong>ASAP</strong>
|
| 145 |
eg: <strong>Choosing Max Hands</strong> or <strong>Using Webcam.</strong>
|
| 146 |
-
Webcam Will Take about <strong>20 Seconds</strong> to Load
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
# st.markdown('''Video Option will Experience **Lag** in **Browsers**. If It's **Lagging** just **Reload** & Choose your option ASAP eg: **Choosing Max Hands** or **Using Webcam**. Webcam Will Take about **20 Seconds** to Load ''')
|
| 148 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 149 |
|
|
|
|
| 150 |
|
| 151 |
elif app_mode == 'Run on Image':
|
| 152 |
drawing_spec = mp_drawing.DrawingSpec(thickness=2, circle_radius=1)
|
|
@@ -180,13 +177,10 @@ elif app_mode == 'Run on Image':
|
|
| 180 |
file_bytes = np.asarray(bytearray(img_file_buffer.read()), dtype=np.uint8)
|
| 181 |
opencv_image = cv2.imdecode(file_bytes, 1)
|
| 182 |
image = opencv_image.copy()
|
| 183 |
-
|
| 184 |
else:
|
| 185 |
demo_image= DEMO_IMAGE
|
| 186 |
-
|
| 187 |
-
# opencv_image = cv2.imdecode(file_bytes, 1)
|
| 188 |
-
# image = opencv_image.copy()
|
| 189 |
-
# image= np.array(Image.open(demo_image))
|
| 190 |
image = 'demo.jpg'
|
| 191 |
cap = cv2.imread('demo.jpg', cv2.IMREAD_UNCHANGED)
|
| 192 |
image = cap.copy()
|
|
@@ -195,10 +189,8 @@ elif app_mode == 'Run on Image':
|
|
| 195 |
st.sidebar.subheader('Input Image')
|
| 196 |
image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
|
| 197 |
st.sidebar.image(image)
|
| 198 |
-
# st.sidebar.markdown('---')
|
| 199 |
-
# st.sidebar.text('Demo Image')
|
| 200 |
st.sidebar.subheader('Demo Images')
|
| 201 |
-
|
| 202 |
st.sidebar.image('dddemo.jpg')
|
| 203 |
st.sidebar.image('Screenshot 2022-01-09 161732.png')
|
| 204 |
st.sidebar.image('woman-showing-four-fingers-white-background-woman-showing-four-fingers-white-background-closeup-hand-134504006.jpg')
|
|
@@ -207,30 +199,17 @@ elif app_mode == 'Run on Image':
|
|
| 207 |
hand_count =0
|
| 208 |
image = cv2.cvtColor(image,cv2.COLOR_RGB2BGR)
|
| 209 |
cap = cv2.imread('demo.jpg', cv2.IMREAD_UNCHANGED)
|
| 210 |
-
|
| 211 |
-
# xxx= f'{image}'
|
| 212 |
-
# IMAGE_FILE.append(xxx)
|
| 213 |
-
# plt.imshow(image_batch[i].numpy().astype("uint8"))
|
| 214 |
-
# IMAGE_FILE.append(image)
|
| 215 |
-
# image = cv2.imread(opencv_image, cv2.IMREAD_UNCHANGED)
|
| 216 |
-
# IMAGE_FILES.append(image)
|
| 217 |
with mp_hands.Hands(
|
| 218 |
static_image_mode=True,
|
| 219 |
max_num_hands=max_hands,
|
| 220 |
min_detection_confidence=detection_confidence) as hands:
|
| 221 |
|
| 222 |
hand_count+=1
|
| 223 |
-
|
| 224 |
-
# Read an image, flip it around y-axis for correct handedness output (see
|
| 225 |
-
# above).
|
| 226 |
-
# image = cv2.flip(cv2.imread(file), 1)
|
| 227 |
-
# Convert the BGR image to RGB before processing.
|
| 228 |
results = hands.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
| 229 |
|
| 230 |
-
|
| 231 |
-
# int('Handedness:', results.multi_handedness)
|
| 232 |
-
# if not results.multi_hand_landmarks:
|
| 233 |
-
# continue
|
| 234 |
try:
|
| 235 |
|
| 236 |
age_height, image_width, _ = image.shape
|
|
@@ -238,12 +217,7 @@ elif app_mode == 'Run on Image':
|
|
| 238 |
lmList=[]
|
| 239 |
lmList2forModel=[]
|
| 240 |
for hand_landmarks in results.multi_hand_landmarks:
|
| 241 |
-
|
| 242 |
-
# print(
|
| 243 |
-
# f'Index finger tip coordinates: (',
|
| 244 |
-
# f'{hand_landmarks.landmark[mp_hands.HandLandmark.INDEX_FINGER_TIP].x * image_width}, '
|
| 245 |
-
# f'{hand_landmarks.landmark[mp_hands.HandLandmark.INDEX_FINGER_TIP].y * image_height})'
|
| 246 |
-
# )
|
| 247 |
myHands=results.multi_hand_landmarks[0]
|
| 248 |
|
| 249 |
for id,lm in enumerate(myHands.landmark):
|
|
@@ -271,10 +245,7 @@ elif app_mode == 'Run on Image':
|
|
| 271 |
total= fingers.count(1)
|
| 272 |
|
| 273 |
if total==5:
|
| 274 |
-
|
| 275 |
-
# st.subheader("Acclerate")
|
| 276 |
-
# mmm=st.markdown("Acclerate")
|
| 277 |
-
# st.markdown('---')
|
| 278 |
original_title = '<p style="font-family:Arial Black; color:#FD0177; font-size: 30px;">Acclerate</p>'
|
| 279 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 280 |
# st.markdown('---')
|
|
@@ -329,36 +300,29 @@ elif app_mode == 'Run on Image':
|
|
| 329 |
mp_hands.HAND_CONNECTIONS,
|
| 330 |
mp_draw.DrawingSpec(color=(0,0,255), thickness=2, circle_radius=2),
|
| 331 |
mp_draw.DrawingSpec(color=(0,255,0), thickness=2, circle_radius=2))
|
| 332 |
-
# annotated_image= cv2.cvtColor(annotated_image,cv2.COLOR_BGR2RGB)
|
| 333 |
kpi1_text.write(f"<h1 style='text-align: center; color:red; '>{hand_count}</h1>", unsafe_allow_html=True)
|
| 334 |
-
# st.subheader('Output Image')
|
| 335 |
-
# st.image(annotated_image, use_column_width=True)
|
| 336 |
except TypeError:
|
| 337 |
-
# st.text('Sorry No Hand Found!!')
|
| 338 |
original_title = '<p style="font-family:Arial Black; color:Red; font-size: 30px;">Sorry, No Hand Found!!</p>'
|
| 339 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 340 |
|
| 341 |
kpi1_text.write(f"<h1 style='text-align: center; color:red; '>{0}</h1>", unsafe_allow_html=True)
|
| 342 |
|
| 343 |
-
|
| 344 |
-
# kpi1_text.write(f"<h1 style='text-align: center; color:red; '>{hand_count}</h1>", unsafe_allow_html=True)
|
| 345 |
st.subheader('Output Image')
|
| 346 |
annotated_image = cv2.cvtColor(annotated_image,cv2.COLOR_BGR2RGB)
|
| 347 |
st.image(annotated_image, use_column_width=False)
|
|
|
|
|
|
|
| 348 |
|
| 349 |
elif app_mode == 'Run On Video':
|
| 350 |
|
| 351 |
st.set_option('deprecation.showfileUploaderEncoding',False)
|
| 352 |
-
# st.text('This is some text.')
|
| 353 |
-
# st.text('This is somext.')
|
| 354 |
use_webcam = st.sidebar.button('Use Webcam')
|
| 355 |
record= st.sidebar.checkbox("Record Video")
|
| 356 |
|
| 357 |
if record:
|
| 358 |
st.checkbox("Recording",value=True)
|
| 359 |
|
| 360 |
-
# drawing_spec = mp_drawing.DrawingSpec(thickness=2, circle_radius=1)
|
| 361 |
-
# st.sidebar.markdown ('---------' )
|
| 362 |
|
| 363 |
st.markdown(
|
| 364 |
"""
|
|
@@ -372,22 +336,18 @@ elif app_mode == 'Run On Video':
|
|
| 372 |
</style>
|
| 373 |
""",unsafe_allow_html=True,)
|
| 374 |
|
| 375 |
-
# st.markdown("**Detected Hands**")
|
| 376 |
-
# kpi1_text = st.markdown("0")
|
| 377 |
|
| 378 |
max_hands= st.sidebar.number_input('Maximum Number of Hand',value=1,min_value=1,max_value=4)
|
| 379 |
-
# st.sidebar('---')
|
| 380 |
detection_confidence= st.sidebar.slider('Detection Confidence',min_value=0.0,max_value=1.0,value=0.5)
|
| 381 |
tracking_confidence= st.sidebar.slider('Tracking Confidence Confidence',min_value=0.0,max_value=1.0,value=0.5)
|
| 382 |
st.sidebar.markdown('---')
|
| 383 |
|
| 384 |
-
# st.markdown("Output")
|
| 385 |
st.subheader("Input Video")
|
| 386 |
|
| 387 |
stframe = st.empty()
|
| 388 |
video_file_buffer = st.sidebar.file_uploader("Upload a Video", type=['mp4', 'mov', 'avi', 'asf', 'm4v'])
|
| 389 |
tffile = tempfile.NamedTemporaryFile(delete=False)
|
| 390 |
-
#
|
| 391 |
if not video_file_buffer:
|
| 392 |
if use_webcam:
|
| 393 |
vid = cv2.VideoCapture(0)
|
|
@@ -400,37 +360,33 @@ elif app_mode == 'Run On Video':
|
|
| 400 |
width = int(vid.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 401 |
height = int(vid.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 402 |
fps_input = int(vid.get(cv2.CAP_PROP_FPS))
|
|
|
|
| 403 |
#Recording Part
|
| 404 |
codec = cv2.VideoWriter_fourcc('V', 'P', '0','9')
|
| 405 |
out= cv2.VideoWriter('output.mp4',codec,fps_input,(width,height))
|
| 406 |
|
| 407 |
st.sidebar.text('Input Video')
|
| 408 |
st.sidebar.video(tffile.name)
|
| 409 |
-
# st.markdown('Reload , if webpage hangs')
|
| 410 |
|
| 411 |
fps = 0
|
| 412 |
i = 0
|
| 413 |
drawing_spec = mp_drawing.DrawingSpec(thickness=2, circle_radius=1)
|
| 414 |
kpi1, kpi2, kpi3 = st.columns(3)
|
| 415 |
with kpi1:
|
| 416 |
-
# st.markdown("**Frame Rate**")
|
| 417 |
original_title = '<p style="text-align: center; font-size: 20px;"><strong>Frame Rate</strong></p>'
|
| 418 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 419 |
kpi1_text = st.markdown ("0")
|
| 420 |
with kpi2:
|
| 421 |
-
# st.markdown("**Detected Hands**")
|
| 422 |
original_title = '<p style="text-align: center; font-size: 20px;"><strong>Detected Hands</strong></p>'
|
| 423 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 424 |
kpi2_text = st.markdown ("0")
|
| 425 |
with kpi3:
|
| 426 |
-
# st.markdown("**Width**")
|
| 427 |
original_title = '<p style="text-align: center; font-size: 20px;"><strong>Video Width</strong></p>'
|
| 428 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 429 |
kpi3_text = st.markdown("0")
|
| 430 |
st.markdown ("<hr/>", unsafe_allow_html=True)
|
| 431 |
st.subheader('Reload , if webpage hangs')
|
| 432 |
drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
|
| 433 |
-
# st.subheader("Input Video")
|
| 434 |
|
| 435 |
with mp_hand.Hands(max_num_hands=max_hands,min_detection_confidence=detection_confidence,
|
| 436 |
min_tracking_confidence=tracking_confidence) as hands:
|
|
@@ -440,8 +396,6 @@ elif app_mode == 'Run On Video':
|
|
| 440 |
|
| 441 |
i +=1
|
| 442 |
ret, image = vid.read()
|
| 443 |
-
# image.set(3, 640)
|
| 444 |
-
# image.set(4, 480)
|
| 445 |
if not ret:
|
| 446 |
continue
|
| 447 |
|
|
@@ -456,10 +410,6 @@ elif app_mode == 'Run On Video':
|
|
| 456 |
hand_count=0
|
| 457 |
if results.multi_hand_landmarks:
|
| 458 |
|
| 459 |
-
# original_title = 'Acclerate'
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
# Face Landmark Drawing
|
| 463 |
for hand_landmark in results.multi_hand_landmarks:
|
| 464 |
hand_count += 1
|
| 465 |
myHands=results.multi_hand_landmarks[0]
|
|
@@ -485,12 +435,7 @@ elif app_mode == 'Run On Video':
|
|
| 485 |
fingers.append(0)
|
| 486 |
|
| 487 |
total= fingers.count(1)
|
| 488 |
-
# print('**********')
|
| 489 |
-
# print(total)
|
| 490 |
if total==5:
|
| 491 |
-
# print('brake')
|
| 492 |
-
# st.text('Acclerate')
|
| 493 |
-
# original_title= 'Acc'
|
| 494 |
sh= "Acclerate"
|
| 495 |
draw(sh)
|
| 496 |
if total==2 or total==3:
|
|
@@ -502,13 +447,11 @@ elif app_mode == 'Run On Video':
|
|
| 502 |
if total==0:
|
| 503 |
sh= "Brake"
|
| 504 |
draw(sh)
|
| 505 |
-
# time.sleep(1)
|
| 506 |
-
# original_title = '<p style="font-family:Arial Black; color:Blue; font-size: 30px;">{original_title}</p>'
|
| 507 |
-
# st.markdown(original_title, unsafe_allow_html=True)
|
| 508 |
|
| 509 |
mp_draw.draw_landmarks(image,hand_landmark,mp_hand.HAND_CONNECTIONS,
|
| 510 |
mp_draw.DrawingSpec(color=(0,0,255), thickness=2, circle_radius=2),
|
| 511 |
mp_draw.DrawingSpec(color=(0,255,0), thickness=2, circle_radius=2))
|
|
|
|
| 512 |
#FPS Counter Logic
|
| 513 |
currTime = time.time()
|
| 514 |
fps = 1/ (currTime - prevTime)
|
|
@@ -526,19 +469,130 @@ elif app_mode == 'Run On Video':
|
|
| 526 |
image = cv2.resize(image, (0,0), fx = 0.8, fy =0.8)
|
| 527 |
image = image_resize(image = image, width = 320,height=360)
|
| 528 |
stframe.image(image, channels = 'BGR', use_column_width=False)
|
| 529 |
-
# else:
|
| 530 |
-
# output_video = open('output1.mp4','rb')
|
| 531 |
-
# out_bytes= output_video.read()
|
| 532 |
-
# st.video(out_bytes)
|
| 533 |
st.subheader('Output Image')
|
| 534 |
st.text('Video Processed')
|
| 535 |
output_video = open('output1.mp4','rb')
|
| 536 |
out_bytes= output_video.read()
|
| 537 |
st.video(out_bytes)
|
| 538 |
-
# st.markdown('Reload , if webpage hangs')
|
| 539 |
|
| 540 |
vid.release()
|
| 541 |
out.release()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 542 |
|
| 543 |
|
| 544 |
|
|
|
|
| 1 |
+
from bokeh.themes import theme
|
| 2 |
from numpy.core.records import record
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
import numpy as np
|
| 5 |
import cv2
|
|
|
|
| 7 |
import time
|
| 8 |
from PIL import Image
|
| 9 |
import tempfile
|
| 10 |
+
from bokeh.models.widgets import Div
|
| 11 |
+
import streamlit as st
|
| 12 |
+
# ---------------------------------------------------------------------
|
| 13 |
+
st.set_page_config(
|
| 14 |
+
page_title="Game Keys",
|
| 15 |
+
page_icon="🎮",
|
| 16 |
+
layout="wide",
|
| 17 |
+
initial_sidebar_state="expanded"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# ---------------------------------------------------------------------
|
| 21 |
|
| 22 |
DEMO_IMAGE = 'demo.jpg'
|
| 23 |
DEMO_VIDEO = 'test3.mp4'
|
|
|
|
| 25 |
currTime=0
|
| 26 |
tipIds= [4,8,12,16,20]
|
| 27 |
st.title('Game Keys with Hand Tracking Web-App')
|
|
|
|
|
|
|
| 28 |
url = 'https://github.com/shashankanand13monu/Game-Automation'
|
| 29 |
|
| 30 |
+
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
mp_drawing = mp.solutions.drawing_utils
|
| 33 |
mp_draw= mp.solutions.drawing_utils
|
|
|
|
| 35 |
mp_draw= mp.solutions.drawing_utils
|
| 36 |
mp_hand= mp.solutions.hands
|
| 37 |
mp_hands = mp.solutions.hands
|
|
|
|
| 38 |
mp_drawing_styles = mp.solutions.drawing_styles
|
| 39 |
+
|
| 40 |
+
# ----------------------------------------------------------------------
|
| 41 |
+
|
|
|
|
|
|
|
| 42 |
t = st.empty()
|
| 43 |
def draw(str):
|
|
|
|
|
|
|
|
|
|
| 44 |
t.markdown(f'<p style="font-family:Arial Black;color:#FF0686;font-size:28px;;">{str}</p>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
# ----------------------------------------------------------------------
|
| 47 |
|
| 48 |
st.markdown(
|
| 49 |
"""
|
|
|
|
| 56 |
margin-left: -350px
|
| 57 |
</style>
|
| 58 |
""",unsafe_allow_html=True,)
|
| 59 |
+
# ----------------------------------------------------------------------
|
| 60 |
+
if st.sidebar.button('Github'):
|
| 61 |
+
js = "window.open('https://github.com/shashankanand13monu/Game-Automation')" # New tab or window
|
| 62 |
+
# js = "window.location.href = 'https://www.streamlit.io/'" # Current tab
|
| 63 |
+
html = '<img src onerror="{}">'.format(js)
|
| 64 |
+
div = Div(text=html)
|
| 65 |
+
st.bokeh_chart(div)
|
| 66 |
+
|
| 67 |
+
# ----------------------------------------------------------------------
|
| 68 |
|
| 69 |
+
st.sidebar.title('Menu')
|
| 70 |
st.sidebar.subheader('Settings')
|
| 71 |
|
| 72 |
+
# ----------------------------------------------------------------------
|
| 73 |
@st.cache ()
|
| 74 |
+
# ----------------------------------------------------------------------
|
| 75 |
+
|
| 76 |
def image_resize(image, width=None, height=None, inter =cv2.INTER_AREA):
|
| 77 |
|
| 78 |
dim = None
|
|
|
|
| 88 |
#resize the image
|
| 89 |
resized =cv2.resize(image, dim ,interpolation=inter)
|
| 90 |
return resized
|
| 91 |
+
# ----------------------------------------------------------------------
|
| 92 |
|
| 93 |
app_mode= st.sidebar.selectbox('Choose the App Mode',
|
| 94 |
+
['About App','Run on Image','Run On Video','Show Code'])
|
| 95 |
|
| 96 |
+
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
if app_mode== 'About App':
|
| 99 |
st.markdown('App Made using **Mediapipe** & **Open CV**')
|
|
|
|
| 124 |
st.image('wsad.jpg',width=200)
|
| 125 |
original_title = '<pre style="font-family:Aku & Kamu; color:#FD0101 ; font-size: 28px;font-weight:Bold">*NOTE</pre>'
|
| 126 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 127 |
+
original_title= '''<pre style="font-family:Aku & Kamu; color:#FD0160 ; font-size: 24px;">
|
| 128 |
Video Option will Experience Lag in Browsers.
|
| 129 |
If It's <strong>Lagging</strong> just <strong>Reload</strong> & Choose your option <strong>ASAP</strong>
|
| 130 |
eg: <strong>Choosing Max Hands</strong> or <strong>Using Webcam.</strong>
|
| 131 |
+
Webcam Will Take about <strong>20 Seconds</strong> to Load
|
| 132 |
+
|
| 133 |
+
Update :
|
| 134 |
+
1) I Discovered that you can't use Webcam Online,
|
| 135 |
+
Because then it will try Access Server's Which i don't Own.
|
| 136 |
+
|
| 137 |
+
2) Hand Marks are not showing online + Video freezes
|
| 138 |
+
|
| 139 |
+
<strong>Solution :</strong>
|
| 140 |
+
Go to main Streamlit WebApp Code & Run it Locally by typing
|
| 141 |
+
<strong>streamlit run st2.py</strong>
|
| 142 |
+
</pre>'''
|
| 143 |
# st.markdown('''Video Option will Experience **Lag** in **Browsers**. If It's **Lagging** just **Reload** & Choose your option ASAP eg: **Choosing Max Hands** or **Using Webcam**. Webcam Will Take about **20 Seconds** to Load ''')
|
| 144 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 145 |
|
| 146 |
+
# ----------------------------------------------------------------------
|
| 147 |
|
| 148 |
elif app_mode == 'Run on Image':
|
| 149 |
drawing_spec = mp_drawing.DrawingSpec(thickness=2, circle_radius=1)
|
|
|
|
| 177 |
file_bytes = np.asarray(bytearray(img_file_buffer.read()), dtype=np.uint8)
|
| 178 |
opencv_image = cv2.imdecode(file_bytes, 1)
|
| 179 |
image = opencv_image.copy()
|
| 180 |
+
|
| 181 |
else:
|
| 182 |
demo_image= DEMO_IMAGE
|
| 183 |
+
|
|
|
|
|
|
|
|
|
|
| 184 |
image = 'demo.jpg'
|
| 185 |
cap = cv2.imread('demo.jpg', cv2.IMREAD_UNCHANGED)
|
| 186 |
image = cap.copy()
|
|
|
|
| 189 |
st.sidebar.subheader('Input Image')
|
| 190 |
image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
|
| 191 |
st.sidebar.image(image)
|
|
|
|
|
|
|
| 192 |
st.sidebar.subheader('Demo Images')
|
| 193 |
+
|
| 194 |
st.sidebar.image('dddemo.jpg')
|
| 195 |
st.sidebar.image('Screenshot 2022-01-09 161732.png')
|
| 196 |
st.sidebar.image('woman-showing-four-fingers-white-background-woman-showing-four-fingers-white-background-closeup-hand-134504006.jpg')
|
|
|
|
| 199 |
hand_count =0
|
| 200 |
image = cv2.cvtColor(image,cv2.COLOR_RGB2BGR)
|
| 201 |
cap = cv2.imread('demo.jpg', cv2.IMREAD_UNCHANGED)
|
| 202 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
with mp_hands.Hands(
|
| 204 |
static_image_mode=True,
|
| 205 |
max_num_hands=max_hands,
|
| 206 |
min_detection_confidence=detection_confidence) as hands:
|
| 207 |
|
| 208 |
hand_count+=1
|
| 209 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
results = hands.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
|
| 211 |
|
| 212 |
+
|
|
|
|
|
|
|
|
|
|
| 213 |
try:
|
| 214 |
|
| 215 |
age_height, image_width, _ = image.shape
|
|
|
|
| 217 |
lmList=[]
|
| 218 |
lmList2forModel=[]
|
| 219 |
for hand_landmarks in results.multi_hand_landmarks:
|
| 220 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
myHands=results.multi_hand_landmarks[0]
|
| 222 |
|
| 223 |
for id,lm in enumerate(myHands.landmark):
|
|
|
|
| 245 |
total= fingers.count(1)
|
| 246 |
|
| 247 |
if total==5:
|
| 248 |
+
|
|
|
|
|
|
|
|
|
|
| 249 |
original_title = '<p style="font-family:Arial Black; color:#FD0177; font-size: 30px;">Acclerate</p>'
|
| 250 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 251 |
# st.markdown('---')
|
|
|
|
| 300 |
mp_hands.HAND_CONNECTIONS,
|
| 301 |
mp_draw.DrawingSpec(color=(0,0,255), thickness=2, circle_radius=2),
|
| 302 |
mp_draw.DrawingSpec(color=(0,255,0), thickness=2, circle_radius=2))
|
|
|
|
| 303 |
kpi1_text.write(f"<h1 style='text-align: center; color:red; '>{hand_count}</h1>", unsafe_allow_html=True)
|
|
|
|
|
|
|
| 304 |
except TypeError:
|
|
|
|
| 305 |
original_title = '<p style="font-family:Arial Black; color:Red; font-size: 30px;">Sorry, No Hand Found!!</p>'
|
| 306 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 307 |
|
| 308 |
kpi1_text.write(f"<h1 style='text-align: center; color:red; '>{0}</h1>", unsafe_allow_html=True)
|
| 309 |
|
| 310 |
+
|
|
|
|
| 311 |
st.subheader('Output Image')
|
| 312 |
annotated_image = cv2.cvtColor(annotated_image,cv2.COLOR_BGR2RGB)
|
| 313 |
st.image(annotated_image, use_column_width=False)
|
| 314 |
+
|
| 315 |
+
# ----------------------------------------------------------------------
|
| 316 |
|
| 317 |
elif app_mode == 'Run On Video':
|
| 318 |
|
| 319 |
st.set_option('deprecation.showfileUploaderEncoding',False)
|
|
|
|
|
|
|
| 320 |
use_webcam = st.sidebar.button('Use Webcam')
|
| 321 |
record= st.sidebar.checkbox("Record Video")
|
| 322 |
|
| 323 |
if record:
|
| 324 |
st.checkbox("Recording",value=True)
|
| 325 |
|
|
|
|
|
|
|
| 326 |
|
| 327 |
st.markdown(
|
| 328 |
"""
|
|
|
|
| 336 |
</style>
|
| 337 |
""",unsafe_allow_html=True,)
|
| 338 |
|
|
|
|
|
|
|
| 339 |
|
| 340 |
max_hands= st.sidebar.number_input('Maximum Number of Hand',value=1,min_value=1,max_value=4)
|
|
|
|
| 341 |
detection_confidence= st.sidebar.slider('Detection Confidence',min_value=0.0,max_value=1.0,value=0.5)
|
| 342 |
tracking_confidence= st.sidebar.slider('Tracking Confidence Confidence',min_value=0.0,max_value=1.0,value=0.5)
|
| 343 |
st.sidebar.markdown('---')
|
| 344 |
|
|
|
|
| 345 |
st.subheader("Input Video")
|
| 346 |
|
| 347 |
stframe = st.empty()
|
| 348 |
video_file_buffer = st.sidebar.file_uploader("Upload a Video", type=['mp4', 'mov', 'avi', 'asf', 'm4v'])
|
| 349 |
tffile = tempfile.NamedTemporaryFile(delete=False)
|
| 350 |
+
#We get our input video here
|
| 351 |
if not video_file_buffer:
|
| 352 |
if use_webcam:
|
| 353 |
vid = cv2.VideoCapture(0)
|
|
|
|
| 360 |
width = int(vid.get(cv2.CAP_PROP_FRAME_WIDTH))
|
| 361 |
height = int(vid.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
| 362 |
fps_input = int(vid.get(cv2.CAP_PROP_FPS))
|
| 363 |
+
|
| 364 |
#Recording Part
|
| 365 |
codec = cv2.VideoWriter_fourcc('V', 'P', '0','9')
|
| 366 |
out= cv2.VideoWriter('output.mp4',codec,fps_input,(width,height))
|
| 367 |
|
| 368 |
st.sidebar.text('Input Video')
|
| 369 |
st.sidebar.video(tffile.name)
|
|
|
|
| 370 |
|
| 371 |
fps = 0
|
| 372 |
i = 0
|
| 373 |
drawing_spec = mp_drawing.DrawingSpec(thickness=2, circle_radius=1)
|
| 374 |
kpi1, kpi2, kpi3 = st.columns(3)
|
| 375 |
with kpi1:
|
|
|
|
| 376 |
original_title = '<p style="text-align: center; font-size: 20px;"><strong>Frame Rate</strong></p>'
|
| 377 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 378 |
kpi1_text = st.markdown ("0")
|
| 379 |
with kpi2:
|
|
|
|
| 380 |
original_title = '<p style="text-align: center; font-size: 20px;"><strong>Detected Hands</strong></p>'
|
| 381 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 382 |
kpi2_text = st.markdown ("0")
|
| 383 |
with kpi3:
|
|
|
|
| 384 |
original_title = '<p style="text-align: center; font-size: 20px;"><strong>Video Width</strong></p>'
|
| 385 |
st.markdown(original_title, unsafe_allow_html=True)
|
| 386 |
kpi3_text = st.markdown("0")
|
| 387 |
st.markdown ("<hr/>", unsafe_allow_html=True)
|
| 388 |
st.subheader('Reload , if webpage hangs')
|
| 389 |
drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
|
|
|
|
| 390 |
|
| 391 |
with mp_hand.Hands(max_num_hands=max_hands,min_detection_confidence=detection_confidence,
|
| 392 |
min_tracking_confidence=tracking_confidence) as hands:
|
|
|
|
| 396 |
|
| 397 |
i +=1
|
| 398 |
ret, image = vid.read()
|
|
|
|
|
|
|
| 399 |
if not ret:
|
| 400 |
continue
|
| 401 |
|
|
|
|
| 410 |
hand_count=0
|
| 411 |
if results.multi_hand_landmarks:
|
| 412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 413 |
for hand_landmark in results.multi_hand_landmarks:
|
| 414 |
hand_count += 1
|
| 415 |
myHands=results.multi_hand_landmarks[0]
|
|
|
|
| 435 |
fingers.append(0)
|
| 436 |
|
| 437 |
total= fingers.count(1)
|
|
|
|
|
|
|
| 438 |
if total==5:
|
|
|
|
|
|
|
|
|
|
| 439 |
sh= "Acclerate"
|
| 440 |
draw(sh)
|
| 441 |
if total==2 or total==3:
|
|
|
|
| 447 |
if total==0:
|
| 448 |
sh= "Brake"
|
| 449 |
draw(sh)
|
|
|
|
|
|
|
|
|
|
| 450 |
|
| 451 |
mp_draw.draw_landmarks(image,hand_landmark,mp_hand.HAND_CONNECTIONS,
|
| 452 |
mp_draw.DrawingSpec(color=(0,0,255), thickness=2, circle_radius=2),
|
| 453 |
mp_draw.DrawingSpec(color=(0,255,0), thickness=2, circle_radius=2))
|
| 454 |
+
|
| 455 |
#FPS Counter Logic
|
| 456 |
currTime = time.time()
|
| 457 |
fps = 1/ (currTime - prevTime)
|
|
|
|
| 469 |
image = cv2.resize(image, (0,0), fx = 0.8, fy =0.8)
|
| 470 |
image = image_resize(image = image, width = 320,height=360)
|
| 471 |
stframe.image(image, channels = 'BGR', use_column_width=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
st.subheader('Output Image')
|
| 473 |
st.text('Video Processed')
|
| 474 |
output_video = open('output1.mp4','rb')
|
| 475 |
out_bytes= output_video.read()
|
| 476 |
st.video(out_bytes)
|
|
|
|
| 477 |
|
| 478 |
vid.release()
|
| 479 |
out.release()
|
| 480 |
+
|
| 481 |
+
# ----------------------------------------------------------------------
|
| 482 |
+
|
| 483 |
+
elif app_mode == 'Show Code':
|
| 484 |
+
agree = st.checkbox('Show Only Game Code')
|
| 485 |
+
|
| 486 |
+
if agree:
|
| 487 |
+
st.subheader('Game Code')
|
| 488 |
+
uuu12='''<iframe
|
| 489 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=night-owl&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=import%2520cv2%250Aimport%2520mediapipe%2520as%2520mp%250Aimport%2520time%250Aimport%2520pyautogui%250Aimport%2520%2520pydirectinput%250Amp_draw%253D%2520mp.solutions.drawing_utils%250Amp_hand%253D%2520mp.solutions.hands%250Aimport%2520numpy%2520as%2520np%250A%250A%2523----------------------------------------------------------%250Avideo%253D%2520cv2.VideoCapture%280%29%250ApreviousTime%2520%253D%25200%250AcurrentTime%2520%253D%25200%250AtipIds%253D%2520%255B4%252C8%252C12%252C16%252C20%255D%250AclassNames%253D%2520%255B%27okay%27%252C%2520%27peace%27%252C%2520%27thumbs%2520up%27%252C%2520%27thumbs%2520down%27%252C%2520%27call%2520me%27%252C%2520%27stop%27%252C%2520%27rock%27%252C%2520%27live%2520long%27%252C%2520%27fist%27%252C%2520%27smile%27%255D%250Afrom%2520directkeys%2520import%2520ReleaseKey%252CPressKey%252C%2520W%252C%2520A%252C%2520S%252C%2520D%250A%250Awith%2520mp_hand.Hands%28max_num_hands%253D1%252Cmin_detection_confidence%253D0.5%252Cmin_tracking_confidence%253D0.5%29%2520as%2520hands%253A%250A%250A%2520%2520%2520%2520while%2520True%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520ret%252C%2520image%253D%2520video.read%28%29%250A%2520%2520%2520%2520%2520%2520%2520%2520image%253D%2520cv2.cvtColor%28image%252Ccv2.COLOR_BGR2RGB%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520image.flags.writeable%253DFalse%2520%2523To%2520improve%2520performance%252C%2520optionally%2520mark%2520the%2520image%2520as%2520not%2520writeable%2520to%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520pass%2520by%2520reference%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520results%253D%2520hands.process%28image%29%250A%2520%2520%2520%2520%2520%2520%2520%2520image.flags.writeable%253DTrue%250A%2520%2520%2520%2520%2520%2520%2520%2520image%253D%2520cv2.cvtColor%28image%252Ccv2.COLOR_RGB2BGR%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520Calculating%2520the%2520FPS%250A%2520%2520%2520%2520%2520%2520%2520%2520currentTime%2520%253D%2520time.time%28%29%250A%2520%2520%2520%2520%2520%2520%2520%2520fps%2520%253D%25201%2520%252F%2520%28currentTime-previousTime%29%250A%2520%2520%2520%2520%2520%2520%2520%2520previousTime%2520%253D%2520currentTime%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520lmList%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520lmList2forModel%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520Displaying%2520FPS%2520on%2520the%2520image%250A%2520%2520%2520%2520%2520%2520%2520%2520cv2.putText%28image%252C%2520str%28int%28fps%29%29%252B%2522%2520FPS%2522%252C%2520%2810%252C%252070%29%252C%2520cv2.FONT_HERSHEY_COMPLEX%252C%25201%252C%2520%280%252C255%252C0%29%252C%25202%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520if%2520results.multi_hand_landmarks%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520hand_landmark%2520in%2520results.multi_hand_landmarks%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520myHands%253Dresults.multi_hand_landmarks%255B0%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520id%252Clm%2520in%2520enumerate%28myHands.landmark%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520h%252Cw%252Cc%253Dimage.shape%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520cx%252Ccy%253Dint%28lm.x*w%29%252C%2520int%28lm.y*h%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList.append%28%255Bid%252Ccx%252Ccy%255D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList2forModel.append%28%255Bcx%252Ccy%255D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.draw_landmarks%28image%252Chand_landmark%252Cmp_hand.HAND_CONNECTIONS%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C0%252C255%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C0%252C255%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C255%252C0%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520"
|
| 490 |
+
style="width: 1024px; height: 473px; border:0; transform: scale(1); overflow:hidden;"
|
| 491 |
+
sandbox="allow-scripts allow-same-origin">
|
| 492 |
+
</iframe>'''
|
| 493 |
+
|
| 494 |
+
uuu13='''<iframe
|
| 495 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=night-owl&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=%2523---------------------------------------------------------------------------------------------%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520len%28lmList%29%21%253D0%253A%2520%2523%2520No%2520Hand%2520in%2520BackGround%250A%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520lmList%255BtipIds%255B0%255D%255D%255B1%255D%2520%253E%2520lmList%255BtipIds%255B0%255D-1%255D%255B1%255D%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%280%29%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520id%2520in%2520range%281%252C5%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520lmList%255BtipIds%255Bid%255D%255D%255B2%255D%2520%253C%2520lmList%255BtipIds%255Bid%255D-1%255D%255B2%255D%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%280%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520total%253D%2520fingers.count%281%29%250A%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D0%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%28%2522Brake%2522%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28W%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28A%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28S%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520PressKey%28S%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520time.sleep%282%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28S%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520elif%2520total%253D%253D5%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%28%2522GAS%2522%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28S%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28A%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28S%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520PressKey%28W%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520time.sleep%282%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28W%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520pydirectinput.keyUp%28%27s%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520pydirectinput.keyDown%28%27w%27%29%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520elif%2520total%253D%253D4%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%28%2522Right%2522%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28W%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520PressKey%28D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520time.sleep%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520elif%2520total%253D%253D2%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520print%28%2522LEFT%2522%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520PressKey%28A%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520time.sleep%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ReleaseKey%28A%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520cv2.imshow%28%2522Frame%2522%252Cimage%29%250A%2520%2520%2520%2520%2520%2520%2520%2520k%253D%2520cv2.waitKey%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520if%2520k%253D%253Dord%28%27q%27%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520break%250Avideo.release%28%29%250Acv2.destroyAllWindows%28%29%250A%2520"
|
| 496 |
+
style="width: 1024px; height: 473px; border:0; transform: scale(1); overflow:hidden;"
|
| 497 |
+
sandbox="allow-scripts allow-same-origin">
|
| 498 |
+
</iframe>'''
|
| 499 |
+
|
| 500 |
+
st.components.v1.html(uuu12,height=470,scrolling=True)
|
| 501 |
+
st.components.v1.html(uuu13,height=470,scrolling=True)
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
# code = '''def hello():
|
| 505 |
+
# print("Helliiiiiiiio, Streamlit!")'''
|
| 506 |
+
# st.code(code, language='python')
|
| 507 |
+
|
| 508 |
+
else:
|
| 509 |
+
st.subheader('Streamlit Code')
|
| 510 |
+
# 11898
|
| 511 |
+
uuu= '''<iframe
|
| 512 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17.5px&lh=133%25&si=false&es=2x&wm=false&code=from%2520bokeh.themes%2520import%2520theme%250Afrom%2520numpy.core.records%2520import%2520record%250Aimport%2520pandas%2520as%2520pd%250Aimport%2520numpy%2520as%2520np%250Aimport%2520cv2%250Aimport%2520mediapipe%2520as%2520mp%250Aimport%2520time%250Afrom%2520PIL%2520import%2520Image%250Aimport%2520tempfile%250Afrom%2520bokeh.models.widgets%2520import%2520Div%250Aimport%2520streamlit%2520as%2520st%250A%2523%2520---------------------------------------------------------------------%250Ast.set_page_config%28%250A%2520%2520%2520%2520page_title%253D%2522Game%2520Keys%2522%252C%250A%2520%2520%2520%2520page_icon%253D%2522%25F0%259F%258E%25AE%2522%252C%250A%2520%2520%2520%2520layout%253D%2522wide%2522%252C%250A%2520%2520%2520%2520initial_sidebar_state%253D%2522expanded%2522%250A%29%250A%250A%2523%2520---------------------------------------------------------------------%250A%250ADEMO_IMAGE%2520%253D%2520%27demo.jpg%27%250ADEMO_VIDEO%2520%253D%2520%27test3.mp4%27%250AprevTime%253D0%250AcurrTime%253D0%2520%250AtipIds%253D%2520%255B4%252C8%252C12%252C16%252C20%255D%250Ast.title%28%27Game%2520Keys%2520with%2520Hand%2520Tracking%2520Web-App%27%29%250Aurl%2520%253D%2520%27https%253A%252F%252Fgithub.com%252Fshashankanand13monu%252FGame-Automation%27%250A%250A%2523%2520----------------------------------------------------------------------%250A%250Amp_drawing%2520%253D%2520mp.solutions.drawing_utils%250Amp_draw%253D%2520mp.solutions.drawing_utils%250Amp_face_mesh%2520%253D%2520mp.solutions.face_mesh%250Amp_draw%253D%2520mp.solutions.drawing_utils%250Amp_hand%253D%2520mp.solutions.hands%250Amp_hands%2520%253D%2520mp.solutions.hands%250Amp_drawing_styles%2520%253D%2520mp.solutions.drawing_styles%250A%250A%2523%2520----------------------------------------------------------------------%250A%250At%2520%253D%2520st.empty%28%29%250Adef%2520draw%28str%29%253A%250A%2520%2520%2520%2520t.markdown%28f%27%253Cp%2520style%253D%2522font-family%253AArial%2520Black%253Bcolor%253A%2523FF0686%253Bfont-size%253A28px%253B%253B%2522%253E%257Bstr%257D%253C%252Fp%253E%27%252C%2520unsafe_allow_html%253DTrue%29%250A%250A%2523%2520----------------------------------------------------------------------%250A%250Ast.markdown%28%250A%2520%2520%2520%2520%2522%2522%2522%250A%2520%2520%2520%2520%253Cstyle%253E%250A%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522true%2522%255D%2520%253E%2520div%253Afirst-child%257B%250Awidth%253A%2520350px%250A%257D%250A%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522false%2522%255D%2520%253E%2520div%253Afirst-child%257B%250Awidth%253A%2520350px%250Amargin-left%253A%2520-350px%250A%253C%252Fstyle%253E%250A%2520%2520%2520%2520%2522%2522%2522%252Cunsafe_allow_html%253DTrue%252C%29%250A%2523%2520----------------------------------------------------------------------%250Aif%2520st.sidebar.button%28%27Github%27%29%253A%250A%2520%2520%2520%2520js%2520%253D%2520%2522window.open%28%27https%253A%252F%252Fgithub.com%252Fshashankanand13monu%252FGame-Automation%27%29%2522%2520%2520%2523%2520New%2520tab%2520or%2520window%250A%2520%2520%2520%2520%2523%2520js%2520%253D%2520%2522window.location.href%2520%253D%2520%27https%253A%252F%252Fwww.streamlit.io%252F%27%2522%2520%2520%2523%2520Current%2520tab%250A%2520%2520%2520%2520html%2520%253D%2520%27%253Cimg%2520src%2520onerror%253D%2522%257B%257D%2522%253E%27.format%28js%29%250A%2520%2520%2520%2520div%2520%253D%2520Div%28text%253Dhtml%29%250A%2520%2520%2520%2520st.bokeh_chart%28div%29"
|
| 513 |
+
style="width: 1024px; height: 1500px; border:0; transform: scale(1); overflow:hidden;"
|
| 514 |
+
sandbox="allow-scripts allow-same-origin">
|
| 515 |
+
</iframe>'''
|
| 516 |
+
|
| 517 |
+
uuu2= '''<iframe
|
| 518 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17.5px&lh=133%25&si=false&es=2x&wm=false&code=st.sidebar.title%28%27Menu%27%29%250Ast.sidebar.subheader%28%27Settings%27%29%250A%250A%2523%2520----------------------------------------------------------------------%250A%2540st.cache%2520%28%29%250A%2523%2520----------------------------------------------------------------------%250A%250Adef%2520image_resize%28image%252C%2520width%253DNone%252C%2520height%253DNone%252C%2520inter%2520%253Dcv2.INTER_AREA%29%253A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520dim%2520%253D%2520None%250A%2520%2520%2520%2520%28h%2520%252Cw%29%2520%253D%2520image.shape%255B%253A2%255D%250A%2520%2520%2520%2520if%2520width%2520is%2520None%2520and%2520height%2520is%2520None%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520return%2520image%250A%2520%2520%2520%2520if%2520width%2520is%2520None%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520r%253D%2520width%252Ffloat%28w%29%250A%2520%2520%2520%2520%2520%2520%2520%2520dim%2520%253D%2520%28int%28w*r%29%252C%2520height%29%250A%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520r%2520%253D%2520width%252Ffloat%28w%29%250A%2520%2520%2520%2520%2520%2520%2520%2520dim%2520%253D%2520%28width%252C%2520int%28h*r%29%29%250A%2520%2520%2520%2520%2523resize%2520the%2520image%250A%2520%2520%2520%2520resized%2520%253Dcv2.resize%28image%252C%2520dim%2520%252Cinterpolation%253Dinter%29%250A%2520%2520%2520%2520return%2520resized%250A%2523%2520----------------------------------------------------------------------%250A%250Aapp_mode%253D%2520st.sidebar.selectbox%28%27Choose%2520the%2520App%2520Mode%27%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%255B%27About%2520App%27%252C%27Run%2520on%2520Image%27%252C%27Run%2520On%2520Video%27%252C%27Show%2520Code%27%255D%29%250A%250A%2523%2520----------------------------------------------------------------------%250A%250Aif%2520app_mode%253D%253D%2520%27About%2520App%27%253A%250A%2520%2520%2520%2520st.markdown%28%27App%2520Made%2520using%2520**Mediapipe**%2520%2526%2520**Open%2520CV**%27%29%250A%250A%2520%2520%2520%2520st.markdown%28%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%253Cstyle%253E%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522true%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522false%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520margin-left%253A%2520-350px%250A%2520%2520%2520%2520%253C%252Fstyle%253E%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%252Cunsafe_allow_html%253DTrue%252C%29%250A%250A%2520%2520%2520%2520st.markdown%28%27%27%27%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520Tutorial%2520%255Cn%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%27%27%27%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%29%250A%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cpre%2520style%253D%2522font-family%253AAku%2520%2526%2520Kamu%253B%2520color%253A%2523FD0177%253B%2520font-size%253A%252025px%253Bfont-weight%253ABold%2522%253E%25F0%259F%2595%25B9%25EF%25B8%258F%2520W-%25205%2520Fingers%2520%2520%25F0%259F%2595%25B9%25EF%25B8%258F%2520A-%25202%2520or%25203%2520Fingers%253C%252Fpre%253E%27%250A%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cpre%2520style%253D%2522font-family%253AAku%2520%2526%2520Kamu%253B%2520color%253A%2523FD0177%253B%2520font-size%253A%252025px%253Bfont-weight%253ABold%253B%2522%253E%25F0%259F%2595%25B9%25EF%25B8%258F%2520S-%2520Fist%2520%2520%2520%2520%2520%2520%2520%25F0%259F%2595%25B9%25EF%25B8%258F%2520D-%25204%2520Fingers%253C%252Fpre%253E%27%250A%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2523%2520st.subheader%28%27%27%27W%2520-%25205%2520Fingers%27%27%27%29%250A%2520%2520%2520%2520%2523%2520st.subheader%28%27S%2520-%2520Fist%255Cn%2520A%2520-%25202%2520or%25203%2520Fingers%255Cn%2520D%2520-%25204%2520Fingers%27%29%250A%2520%2520%2520%2520st.image%28%27wsad.jpg%27%252Cwidth%253D200%29%250A%2520"
|
| 519 |
+
style="width: 1024px; height: 1500px; border:0; transform: scale(1); overflow:hidden;"
|
| 520 |
+
sandbox="allow-scripts allow-same-origin">
|
| 521 |
+
</iframe>'''
|
| 522 |
+
|
| 523 |
+
uuu3='''<iframe
|
| 524 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17.5px&lh=133%25&si=false&es=2x&wm=false&code=%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cpre%2520style%253D%2522font-family%253AAku%2520%2526%2520Kamu%253B%2520color%253A%2523FD0101%2520%253B%2520font-size%253A%252028px%253Bfont-weight%253ABold%2522%253E*NOTE%253C%252Fpre%253E%27%250A%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520original_title%253D%2520%27%27%27%253Cpre%2520style%253D%2522font-family%253AAku%2520%2526%2520Kamu%253B%2520color%253A%2523270F40%253B%2520font-size%253A%252024px%253B%2522%253E%250A%2520%2520%2520%2520Video%2520Option%2520will%2520Experience%2520Lag%2520in%2520%2520Browsers.%250A%2520%2520%2520%2520If%2520It%27s%2520%253Cstrong%253ELagging%253C%252Fstrong%253E%2520just%2520%253Cstrong%253EReload%253C%252Fstrong%253E%2520%2526%2520Choose%2520your%2520option%2520%253Cstrong%253EASAP%253C%252Fstrong%253E%2520%250A%2520%2520%2520%2520eg%253A%2520%253Cstrong%253EChoosing%2520Max%2520Hands%253C%252Fstrong%253E%2520or%2520%253Cstrong%253EUsing%2520Webcam.%253C%252Fstrong%253E%2520%250A%2520%2520%2520%2520Webcam%2520Will%2520Take%2520about%2520%253Cstrong%253E20%2520Seconds%253C%252Fstrong%253E%2520to%2520Load%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520Update%2520%253A%250A%2520%2520%2520%25201%29%2520I%2520Discovered%2520that%2520you%2520can%27t%2520use%2520Webcam%2520Online%252C%250A%2520%2520%2520%2520Because%2520then%2520it%2520will%2520try%2520Access%2520Server%27s%2520Which%2520i%2520don%27t%2520Own.%250A%2520%2520%2520%2520%250A%2520%2520%2520%25202%29%2520Hand%2520Marks%2520are%2520not%2520showing%2520online%2520%252B%2520Video%2520freezes%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%253Cstrong%253ESolution%2520%253A%253C%252Fstrong%253E%250A%2520%2520%2520%2520Go%2520to%2520main%2520Streamlit%2520WebApp%2520Code%2520%2526%2520Run%2520it%2520Locally%2520by%2520typing%250A%2520%2520%2520%2520%253Cstrong%253Estreamlit%2520run%2520st2.py%253C%252Fstrong%253E%250A%2520%2520%2520%2520%253C%252Fpre%253E%27%27%27%250A%2520%2520%2520%2520%2523%2520st.markdown%28%27%27%27Video%2520Option%2520will%2520Experience%2520**Lag**%2520in%2520**Browsers**.%2520If%2520It%27s%2520**Lagging**%2520just%2520**Reload**%2520%2526%2520Choose%2520your%2520option%2520ASAP%2520eg%253A%2520**Choosing%2520Max%2520Hands**%2520or%2520**Using%2520Webcam**.%2520Webcam%2520Will%2520Take%2520about%2520**20%2520Seconds**%2520to%2520Load%2520%27%27%27%29%250A%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%250A%2523%2520----------------------------------------------------------------------%250A%2520%2520%2520%2520%250Aelif%2520app_mode%2520%253D%253D%2520%27Run%2520on%2520Image%27%253A%250A%2520%2520%2520%2520drawing_spec%2520%253D%2520mp_drawing.DrawingSpec%28thickness%253D2%252C%2520circle_radius%253D1%29%250A%2520%2520%2520%2520st.sidebar.markdown%2520%28%27---------%27%2520%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.markdown%28%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%253Cstyle%253E%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522true%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522false%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520margin-left%253A%2520-350px%250A%2520%2520%2520%2520%253C%252Fstyle%253E%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%252Cunsafe_allow_html%253DTrue%252C%29%250A%250A%2520%2520%2520%2520%2523%2520st.markdown%28%2522**Detected%2520Hands**%2522%29%250A%2520%2520%2520%2520st.header%28%2522**%2520%2520%2520Detected%2520Hands%2520%2520%2520**%2522%29%250A%2520%2520%2520%2520kpi1_text%2520%253D%2520st.markdown%28%25220%2522%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520max_hands%253D%2520st.sidebar.number_input%28%27Maximum%2520Number%2520of%2520Hands%27%252Cvalue%253D2%252Cmin_value%253D1%252Cmax_value%253D4%29%250A%2520%2520%2520%2520%2523%2520st.sidebar%28%27---%27%29%250A%2520%2520%2520"
|
| 525 |
+
style="width: 1024px; height: 1500px; border:0; transform: scale(1); overflow:hidden;"
|
| 526 |
+
sandbox="allow-scripts allow-same-origin">
|
| 527 |
+
</iframe>'''
|
| 528 |
+
|
| 529 |
+
uuu4='''<iframe
|
| 530 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=true&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17.5px&lh=133%25&si=false&es=2x&wm=false&code=%2509detection_confidence%253D%2520st.sidebar.slider%28%27Detection%2520Confidence%27%252Cmin_value%253D0.0%252Cmax_value%253D1.0%252Cvalue%253D0.5%29%250A%2520%2520%2520%2520st.sidebar.markdown%28%27---%27%29%250A%2520%2520%2520%2520IMAGE_FILE%253D%255B%255D%250A%2520%2520%2520%2520count%253D0%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520img_file_buffer%2520%253D%2520st.sidebar.file_uploader%28%2522Upload%2520an%2520Image%2522%252C%2520type%253D%255B%2522jpg%2522%252C%2522jpeg%2522%252C%2520%2522png%2522%255D%29%250A%2520%2520%2520%2520if%2520img_file_buffer%2520is%2520not%2520None%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520file_bytes%2520%253D%2520np.asarray%28bytearray%28img_file_buffer.read%28%29%29%252C%2520dtype%253Dnp.uint8%29%250A%2520%2520%2520%2520%2520%2520%2520%2520opencv_image%2520%253D%2520cv2.imdecode%28file_bytes%252C%25201%29%250A%2520%2520%2520%2520%2520%2520%2520%2520image%2520%253D%2520opencv_image.copy%28%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520demo_image%253D%2520DEMO_IMAGE%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520image%2520%253D%2520%27demo.jpg%27%250A%2520%2520%2520%2520%2520%2520%2520%2520cap%2520%253D%2520cv2.imread%28%27demo.jpg%27%252C%2520cv2.IMREAD_UNCHANGED%29%250A%2520%2520%2520%2520%2520%2520%2520%2520image%2520%253D%2520cap.copy%28%29%250A%250A%2520%2520%2520%2520%2523%2520st.sidebar.text%28%27Input%2520Image%27%29%250A%2520%2520%2520%2520st.sidebar.subheader%28%27Input%2520Image%27%29%250A%2520%2520%2520%2520image%2520%253D%2520cv2.cvtColor%28image%252Ccv2.COLOR_BGR2RGB%29%250A%2520%2520%2520%2520st.sidebar.image%28image%29%2520%250A%2520%2520%2520%2520st.sidebar.subheader%28%27Demo%2520Images%27%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.sidebar.image%28%27dddemo.jpg%27%29%2520%2520%250A%2520%2520%2520%2520st.sidebar.image%28%27Screenshot%25202022-01-09%2520161732.png%27%29%250A%2520%2520%2520%2520st.sidebar.image%28%27woman-showing-four-fingers-white-background-woman-showing-four-fingers-white-background-closeup-hand-134504006.jpg%27%29%250A%250A%2520%2520%2520%2520st.sidebar.image%28%27demo.jpg%27%29%250A%2520%2520%2520%2520hand_count%2520%253D0%250A%2520%2520%2520%2520image%2520%253D%2520cv2.cvtColor%28image%252Ccv2.COLOR_RGB2BGR%29%250A%2520%2520%2520%2520cap%2520%253D%2520cv2.imread%28%27demo.jpg%27%252C%2520cv2.IMREAD_UNCHANGED%29%250A%2520%2520%2520%250A%2520%2520%2520%2520with%2520mp_hands.Hands%28%250A%2520%2520%2520%2520static_image_mode%253DTrue%252C%250A%2520%2520%2520%2520max_num_hands%253Dmax_hands%252C%250A%2520%2520%2520%2520min_detection_confidence%253Ddetection_confidence%29%2520as%2520hands%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520hand_count%252B%253D1%250A%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520results%2520%253D%2520hands.process%28cv2.cvtColor%28image%252C%2520cv2.COLOR_BGR2RGB%29%29%250A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520try%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520age_height%252C%2520image_width%252C%2520_%2520%253D%2520image.shape%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%2520%253D%2520image.copy%28%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList2forModel%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520hand_landmarks%2520in%2520results.multi_hand_landmarks%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520myHands%253Dresults.multi_hand_landmarks%255B0%255D%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520id%252Clm%2520in%2520enumerate%28myHands.landmark%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520h%252Cw%252Cc%253Dimage.shape%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520cx%252Ccy%253Dint%28lm.x*w%29%252C%2520int%28lm.y*h%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList.append%28%255Bid%252Ccx%252Ccy%255D%29"
|
| 531 |
+
style="width: 1024px; height: 1470px; border:0; transform: scale(1); overflow:hidden;"
|
| 532 |
+
sandbox="allow-scripts allow-same-origin">
|
| 533 |
+
</iframe>'''
|
| 534 |
+
|
| 535 |
+
uuu5='''<iframe
|
| 536 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17.5px&lh=133%25&si=false&es=2x&wm=false&code=%2509%2509%2509%2509%2509lmList2forModel.append%28%255Bcx%252Ccy%255D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520lmList%255BtipIds%255B0%255D%255D%255B1%255D%2520%253C%2520lmList%255BtipIds%255B0%255D-1%255D%255B1%255D%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%280%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520id%2520in%2520range%281%252C5%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520lmList%255BtipIds%255Bid%255D%255D%255B2%255D%2520%253C%2520lmList%255BtipIds%255Bid%255D-1%255D%255B2%255D%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%280%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520total%253D%2520fingers.count%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D5%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522font-family%253AArial%2520Black%253B%2520color%253A%2523FD0177%253B%2520font-size%253A%252030px%253B%2522%253EAcclerate%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520st.markdown%28%27---%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.imread%28%27istockphoto-1179377734-612x612.jpg%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.resize%28overlay%252C%28100%252C100%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_offset%2520%253D%252080%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_offset%2520%253D%252010%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_end%2520%253D%2520x_offset%2520%252B%2520overlay.shape%255B1%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_end%2520%253D%2520y_offset%2520%252B%2520overlay.shape%255B0%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%255By_offset%253Ay_end%252Cx_offset%253Ax_end%255D%2520%253D%2520overlay%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D4%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520st.text%28%27Right%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522font-family%253AArial%2520Black%253B%2520color%253A%2523FD0177%253B%2520font-size%253A%252030px%253B%2522%253ERight%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.imread%28%27istockphoto-1179377734-612x612%2520%284%29.jpg%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.resize%28overlay%252C%28100%252C100%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_offset%2520%253D%2520120%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_offset%2520%253D%252050%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_end%2520%253D%2520x_offset%2520%252B%2520overlay.shape%255B1%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_end%2520%253D%2520y_offset%2520%252B%2520overlay.shape%255B0%255D%250A%2520%2520%2520%2520%2520%2520%2520"
|
| 537 |
+
style="width: 1024px; height: 4328px; border:0; transform: scale(1); overflow:hidden;"
|
| 538 |
+
sandbox="allow-scripts allow-same-origin">
|
| 539 |
+
</iframe>'''
|
| 540 |
+
|
| 541 |
+
uuu6='''<iframe
|
| 542 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17.5px&lh=133%25&si=false&es=2x&wm=false&code=%2509%2509%2509%2509%2509annotated_image%255By_offset%253Ay_end%252Cx_offset%253Ax_end%255D%2520%253D%2520overlay%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D2%2520or%2520total%253D%253D3%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520st.text%28%27Left%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522font-family%253AArial%2520Black%253B%2520color%253A%2523FD0177%253B%2520font-size%253A%252030px%253B%2522%253ELeft%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.imread%28%27istockphoto-1179377734-612x612%2520%281%29.jpg%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.resize%28overlay%252C%28100%252C100%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_offset%2520%253D%252050%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_offset%2520%253D%252050%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_end%2520%253D%2520x_offset%2520%252B%2520overlay.shape%255B1%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_end%2520%253D%2520y_offset%2520%252B%2520overlay.shape%255B0%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%255By_offset%253Ay_end%252Cx_offset%253Ax_end%255D%2520%253D%2520overlay%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D0%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523%2520st.text%28%27Brake%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522font-family%253AArial%2520Black%253B%2520color%253A%2523FD0177%253B%2520font-size%253A%252030px%253B%2522%253EBrake%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.imread%28%27istockphoto-1179377734-612x612%2520%283%29.jpg%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520overlay%2520%253D%2520cv2.resize%28overlay%252C%28100%252C100%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_offset%2520%253D%252050%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_offset%2520%253D%252090%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520x_end%2520%253D%2520x_offset%2520%252B%2520overlay.shape%255B1%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520y_end%2520%253D%2520y_offset%2520%252B%2520overlay.shape%255B0%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%255By_offset%253Ay_end%252Cx_offset%253Ax_end%255D%2520%253D%2520overlay%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_drawing.draw_landmarks%28%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520hand_landmarks%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_hands.HAND_CONNECTIONS%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C0%252C255%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C255%252C0%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kpi1_text.write%28f%2522%253Ch1%2520style%253D%27text-align%253A%2520center%253B%2520color%253Ared%253B%2520%27%253E%257Bhand_count%257D%253C%252Fh1%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520except%2520TypeError%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522font-family%253AArial%2520Black%253B%2520color%253ARed%253B%2520font-size%253A%252030px%253B%2522%253ESorry%252C%2520No%2520Hand%2520Found%21%21%253C"
|
| 543 |
+
style="width: 923px; height: 5304px; border:0; transform: scale(1); overflow:hidden;"
|
| 544 |
+
sandbox="allow-scripts allow-same-origin">
|
| 545 |
+
</iframe>'''
|
| 546 |
+
|
| 547 |
+
uuu7='''<iframe
|
| 548 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=%2509%2509%2509st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kpi1_text.write%28f%2522%253Ch1%2520style%253D%27text-align%253A%2520center%253B%2520color%253Ared%253B%2520%27%253E%257B0%257D%253C%252Fh1%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%250A%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520st.subheader%28%27Output%2520Image%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%2520%253D%2520cv2.cvtColor%28annotated_image%252Ccv2.COLOR_BGR2RGB%29%250A%2520%2520%2520%2520%2520%2520%2520%2520st.image%28annotated_image%252C%2520use_column_width%253DFalse%29%250A%250A%2523%2520----------------------------------------------------------------------%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250Aelif%2520app_mode%2520%253D%253D%2520%27Run%2520On%2520Video%27%253A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.set_option%28%27deprecation.showfileUploaderEncoding%27%252CFalse%29%250A%2520%2520%2520%2520use_webcam%2520%253D%2520st.sidebar.button%28%27Use%2520Webcam%27%29%250A%2520%2520%2520%2520record%253D%2520st.sidebar.checkbox%28%2522Record%2520Video%2522%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520if%2520record%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520st.checkbox%28%2522Recording%2522%252Cvalue%253DTrue%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.markdown%28%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%253Cstyle%253E%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522true%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522false%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520margin-left%253A%2520-350px%250A%2520%2520%2520%2520%253C%252Fstyle%253E%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%252Cunsafe_allow_html%253DTrue%252C%29%250A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520max_hands%253D%2520st.sidebar.number_input%28%27Maximum%2520Number%2520of%2520Hand%27%252Cvalue%253D1%252Cmin_value%253D1%252Cmax_value%253D4%29%250A%2520%2520%2520%2520detection_confidence%253D%2520st.sidebar.slider%28%27Detection%2520Confidence%27%252Cmin_value%253D0.0%252Cmax_value%253D1.0%252Cvalue%253D0.5%29%250A%2520%2520%2520%2520tracking_confidence%253D%2520st.sidebar.slider%28%27Tracking%2520Confidence%2520Confidence%27%252Cmin_value%253D0.0%252Cmax_value%253D1.0%252Cvalue%253D0.5%29%250A%2520%2520%2520%2520st.sidebar.markdown%28%27---%27%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.subheader%28%2522Input%2520Video%2522%29%2520%2520%2520%2520%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520stframe%2520%253D%2520st.empty%28%29%250A%2520%2520%2520%2520video_file_buffer%2520%253D%2520st.sidebar.file_uploader%28%2522Upload%2520a%2520Video%2522%252C%2520type%253D%255B%27mp4%27%252C%2520%27mov%27%252C%2520%27avi%27%252C%2520%27asf%27%252C%2520%27m4v%27%255D%29%250A%2520%2520%2520%2520tffile%2520%253D%2520tempfile.NamedTemporaryFile%28delete%253DFalse%29%250A%2520%2520%2520%2520%2523We%2520get%2520our%2520input%2520video%2520here%250A%2520%2520%2520%2520if%2520not%2520video_file_buffer%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520if%2520use_webcam%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520vid%2520%253D%2520cv2.VideoCapture%280%29%250A%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520vid%2520%253D%2520cv2.VideoCapture%28DEMO_VIDEO%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520tffile.name%2520%253D%2520DEMO_VIDEO%250A%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520tffile.write%28video_file_buffer.read%28%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520vid%2520%253D%2520cv2.VideoCapture%28tffile.name%29%250A%2520%2520%2520%2520width%2520%253D%2520int%28vid.get%28cv2.CAP_PROP_FRAME_WIDTH%29%29%250A%2520%2520%2520%2520height%2520%253D%2520int%28vid.get%28cv2.CAP_"
|
| 549 |
+
style="width: 1024px; height: 4373px; border:0; transform: scale(1); overflow:hidden;"
|
| 550 |
+
sandbox="allow-scripts allow-same-origin">
|
| 551 |
+
</iframe>'''
|
| 552 |
+
|
| 553 |
+
uuu8='''<iframe
|
| 554 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=%2509%2509%2509st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kpi1_text.write%28f%2522%253Ch1%2520style%253D%27text-align%253A%2520center%253B%2520color%253Ared%253B%2520%27%253E%257B0%257D%253C%252Fh1%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%250A%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520st.subheader%28%27Output%2520Image%27%29%250A%2520%2520%2520%2520%2520%2520%2520%2520annotated_image%2520%253D%2520cv2.cvtColor%28annotated_image%252Ccv2.COLOR_BGR2RGB%29%250A%2520%2520%2520%2520%2520%2520%2520%2520st.image%28annotated_image%252C%2520use_column_width%253DFalse%29%250A%250A%2523%2520----------------------------------------------------------------------%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250Aelif%2520app_mode%2520%253D%253D%2520%27Run%2520On%2520Video%27%253A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.set_option%28%27deprecation.showfileUploaderEncoding%27%252CFalse%29%250A%2520%2520%2520%2520use_webcam%2520%253D%2520st.sidebar.button%28%27Use%2520Webcam%27%29%250A%2520%2520%2520%2520record%253D%2520st.sidebar.checkbox%28%2522Record%2520Video%2522%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520if%2520record%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520st.checkbox%28%2522Recording%2522%252Cvalue%253DTrue%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.markdown%28%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%253Cstyle%253E%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522true%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%255Bdata-testid%253D%2522stSidebar%2522%255D%255Baria-expanded%253D%2522false%2522%255D%2520%253E%2520div%253Afirst-child%257B%250A%2520%2520%2520%2520width%253A%2520350px%250A%2520%2520%2520%2520margin-left%253A%2520-350px%250A%2520%2520%2520%2520%253C%252Fstyle%253E%250A%2520%2520%2520%2520%2520%2520%2520%2520%2522%2522%2522%252Cunsafe_allow_html%253DTrue%252C%29%250A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520max_hands%253D%2520st.sidebar.number_input%28%27Maximum%2520Number%2520of%2520Hand%27%252Cvalue%253D1%252Cmin_value%253D1%252Cmax_value%253D4%29%250A%2520%2520%2520%2520detection_confidence%253D%2520st.sidebar.slider%28%27Detection%2520Confidence%27%252Cmin_value%253D0.0%252Cmax_value%253D1.0%252Cvalue%253D0.5%29%250A%2520%2520%2520%2520tracking_confidence%253D%2520st.sidebar.slider%28%27Tracking%2520Confidence%2520Confidence%27%252Cmin_value%253D0.0%252Cmax_value%253D1.0%252Cvalue%253D0.5%29%250A%2520%2520%2520%2520st.sidebar.markdown%28%27---%27%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.subheader%28%2522Input%2520Video%2522%29%2520%2520%2520%2520%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520stframe%2520%253D%2520st.empty%28%29%250A%2520%2520%2520%2520video_file_buffer%2520%253D%2520st.sidebar.file_uploader%28%2522Upload%2520a%2520Video%2522%252C%2520type%253D%255B%27mp4%27%252C%2520%27mov%27%252C%2520%27avi%27%252C%2520%27asf%27%252C%2520%27m4v%27%255D%29%250A%2520%2520%2520%2520tffile%2520%253D%2520tempfile.NamedTemporaryFile%28delete%253DFalse%29%250A%2520%2520%2520%2520%2523We%2520get%2520our%2520input%2520video%2520here%250A%2520%2520%2520%2520if%2520not%2520video_file_buffer%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520if%2520use_webcam%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520vid%2520%253D%2520cv2.VideoCapture%280%29%250A%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520vid%2520%253D%2520cv2.VideoCapture%28DEMO_VIDEO%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520tffile.name%2520%253D%2520DEMO_VIDEO%250A%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520tffile.write%28video_file_buffer.read%28%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520vid%2520%253D%2520cv2.VideoCapture%28tffile.name%29%250A%2520%2520%2520%2520width%2520%253D%2520int%28vid.get%28cv2.CAP_PROP_FRAME_WIDTH%29%29%250A%2520%2520%2520%2520height%2520%253D%2520int%28vid.get%28cv2.CAP_PROP_FRAME_HEIGHT%29%29"
|
| 555 |
+
style="width: 1024px; height: 1400px; border:0; transform: scale(1); overflow:hidden;"
|
| 556 |
+
sandbox="allow-scripts allow-same-origin">
|
| 557 |
+
</iframe>'''
|
| 558 |
+
|
| 559 |
+
uuu9='''<iframe
|
| 560 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=%250A%2520%2520%2520%2520fps_input%2520%253D%2520int%28vid.get%28cv2.CAP_PROP_FPS%29%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%2523Recording%2520Part%250A%2520%2520%2520%2520codec%2520%253D%2520cv2.VideoWriter_fourcc%28%27V%27%252C%2520%27P%27%252C%2520%270%27%252C%279%27%29%250A%2520%2520%2520%2520out%253D%2520cv2.VideoWriter%28%27output.mp4%27%252Ccodec%252Cfps_input%252C%28width%252Cheight%29%29%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520st.sidebar.text%28%27Input%2520Video%27%29%250A%2520%2520%2520%2520st.sidebar.video%28tffile.name%29%250A%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520fps%2520%253D%25200%250A%2520%2520%2520%2520i%2520%253D%25200%250A%2520%2520%2520%2520drawing_spec%2520%253D%2520mp_drawing.DrawingSpec%28thickness%253D2%252C%2520circle_radius%253D1%29%250A%2520%2520%2520%2520kpi1%252C%2520kpi2%252C%2520kpi3%2520%253D%2520st.columns%283%29%250A%2520%2520%2520%2520with%2520kpi1%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522text-align%253A%2520center%253B%2520font-size%253A%252020px%253B%2522%253E%253Cstrong%253EFrame%2520Rate%253C%252Fstrong%253E%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520kpi1_text%2520%253D%2520st.markdown%2520%28%25220%2522%29%250A%2520%2520%2520%2520with%2520kpi2%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522text-align%253A%2520center%253B%2520font-size%253A%252020px%253B%2522%253E%253Cstrong%253EDetected%2520Hands%253C%252Fstrong%253E%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520kpi2_text%2520%253D%2520st.markdown%2520%28%25220%2522%29%250A%2520%2520%2520%2520with%2520kpi3%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520original_title%2520%253D%2520%27%253Cp%2520style%253D%2522text-align%253A%2520center%253B%2520font-size%253A%252020px%253B%2522%253E%253Cstrong%253EVideo%2520Width%253C%252Fstrong%253E%253C%252Fp%253E%27%250A%2520%2520%2520%2520%2520%2520%2520%2520st.markdown%28original_title%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520kpi3_text%2520%253D%2520st.markdown%28%25220%2522%29%250A%2520%2520%2520%2520st.markdown%2520%28%2522%253Chr%252F%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520st.subheader%28%27Reload%2520%252C%2520if%2520webpage%2520hangs%27%29%250A%2520%2520%2520%2520drawing_spec%2520%253D%2520mp_drawing.DrawingSpec%28thickness%253D1%252C%2520circle_radius%253D1%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520with%2520mp_hand.Hands%28max_num_hands%253Dmax_hands%252Cmin_detection_confidence%253Ddetection_confidence%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520min_tracking_confidence%253Dtracking_confidence%29%2520as%2520hands%253A%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520while%2520vid.isOpened%28%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520i%2520%252B%253D1%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ret%252C%2520image%2520%253D%2520vid.read%28%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520not%2520ret%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520continue%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520image.flags.writeable%253DFalse%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520results%253D%2520hands.process%28image%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520image.flags.writeable%253DTrue%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520image%253D%2520cv2.cvtColor%28image%252Ccv2.COLOR_RGB2BGR%29%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList2forModel%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520hand_count%253D0%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520results.multi_hand_landmarks%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520hand_landmark%2520in%2520results.multi_hand_landmarks%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520"
|
| 561 |
+
style="width: 1024px; height: 1500px; border:0; transform: scale(1); overflow:hidden;"
|
| 562 |
+
sandbox="allow-scripts allow-same-origin">
|
| 563 |
+
</iframe>'''
|
| 564 |
+
|
| 565 |
+
uuu10='''<iframe
|
| 566 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520hand_count%2520%252B%253D%25201%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520myHands%253Dresults.multi_hand_landmarks%255B0%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520id%252Clm%2520in%2520enumerate%28myHands.landmark%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520h%252Cw%252Cc%253Dimage.shape%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520cx%252Ccy%253Dint%28lm.x*w%29%252C%2520int%28lm.y*h%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList.append%28%255Bid%252Ccx%252Ccy%255D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520lmList2forModel.append%28%255Bcx%252Ccy%255D%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520lmList%255BtipIds%255B0%255D%255D%255B1%255D%2520%253E%2520lmList%255BtipIds%255B0%255D-1%255D%255B1%255D%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%281%29%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%280%29%250A%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520for%2520id%2520in%2520range%281%252C5%29%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520lmList%255BtipIds%255Bid%255D%255D%255B2%255D%2520%253C%2520lmList%255BtipIds%255Bid%255D-1%255D%255B2%255D%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%281%29%250A%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520else%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers.append%280%29%250A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520total%253D%2520fingers.count%281%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D5%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sh%253D%2520%2522Acclerate%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520draw%28sh%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D2%2520or%2520total%253D%253D3%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sh%253D%2520%2522Left%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520draw%28sh%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D4%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sh%253D%2520%2522Right%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520draw%28sh%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520total%253D%253D0%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520sh%253D%2520%2522Brake%2522%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520draw%28sh%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.draw_landmarks%28image%252Chand_landmark%252Cmp_hand.HAND_CONNECTIONS%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C0%252C255%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%252C%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mp_draw.DrawingSpec%28color%253D%280%252C255%252C0%29%252C%2520thickness%253D2%252C%2520circle_radius%253D2%29%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2523FPS%2520Counter%2520Logic%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520currTime%2520%253D%2520time.time%28%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fps%2520%253D%25201%252F%2520%28currTime%2520-%2520prevTime%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520prevTime%2520%253D%2520currTime%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520fingers%253D%255B%255D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520"
|
| 567 |
+
style="width: 939px; height: 1129px; border:0; transform: scale(1); overflow:hidden;"
|
| 568 |
+
sandbox="allow-scripts allow-same-origin">
|
| 569 |
+
</iframe>'''
|
| 570 |
+
|
| 571 |
+
uuu11='''<iframe
|
| 572 |
+
src="https://carbon.now.sh/embed?bg=rgba%28171%2C+184%2C+195%2C+1%29&t=seti&wt=none&l=python&ds=false&dsyoff=20px&dsblur=68px&wc=false&wa=true&pv=0px&ph=0px&ln=false&fl=1&fm=Hack&fs=17px&lh=133%25&si=false&es=2x&wm=false&code=%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520if%2520record%253A%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520out.write%28image%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520image%253D%2520cv2.cvtColor%28image%252Ccv2.COLOR_BGR2RGB%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kpi1_text.write%28f%2522%253Ch1%2520style%253D%27text-align%253A%2520center%253B%2520color%253Ared%253B%2520%27%253E%257Bint%28fps%29%257D%253C%252Fh1%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kpi2_text.write%28f%2522%253Ch1%2520style%253D%27text-align%253A%2520center%253B%2520color%253Ared%253B%2520%27%253E%257Bhand_count%257D%253C%252Fh1%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kpi3_text.write%28f%2522%253Ch1%2520style%253D%27text-align%253A%2520center%253B%2520color%253Ared%253B%2520%27%253E%257Bwidth%257D%253C%252Fh1%253E%2522%252C%2520unsafe_allow_html%253DTrue%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520image%2520%253D%2520cv2.resize%28image%252C%2520%280%252C0%29%252C%2520fx%2520%253D%25200.8%252C%2520fy%2520%253D0.8%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520image%2520%253D%2520image_resize%28image%2520%253D%2520image%252C%2520width%2520%253D%2520320%252Cheight%253D360%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520stframe.image%28image%252C%2520channels%2520%253D%2520%27BGR%27%252C%2520use_column_width%253DFalse%29%250A%2520%2520%2520%2520st.subheader%28%27Output%2520Image%27%29%250A%2520%2520%2520%2520st.text%28%27Video%2520Processed%27%29%250A%2520%2520%2520%2520output_video%2520%253D%2520open%28%27output1.mp4%27%252C%27rb%27%29%250A%2520%2520%2520%2520out_bytes%253D%2520output_video.read%28%29%250A%2520%2520%2520%2520st.video%28out_bytes%29%250A%2520%2520%2520%2520%2520%2520%2520%2520%250A%2520%2520%2520%2520vid.release%28%29%250A%2520%2520%2520%2520out.release%28%29%250A"
|
| 573 |
+
style="width: 1024px; height: 586px; border:0; transform: scale(1); overflow:hidden;"
|
| 574 |
+
sandbox="allow-scripts allow-same-origin">
|
| 575 |
+
</iframe>'''
|
| 576 |
+
st.components.v1.html(uuu,width=1024,height=1000,scrolling=True)
|
| 577 |
+
st.components.v1.html(uuu2,width=1024,height=1000,scrolling=True)
|
| 578 |
+
st.components.v1.html(uuu3,width=1024,height=1000,scrolling=True)
|
| 579 |
+
st.components.v1.html(uuu4,width=1024,height=1000,scrolling=True)
|
| 580 |
+
st.components.v1.html(uuu5,width=1024,height=1000,scrolling=True)
|
| 581 |
+
st.components.v1.html(uuu6,width=1024,height=1000,scrolling=True)
|
| 582 |
+
st.components.v1.html(uuu7,width=1024,height=1000,scrolling=True)
|
| 583 |
+
st.components.v1.html(uuu8,width=1024,height=1000,scrolling=True)
|
| 584 |
+
st.components.v1.html(uuu9,width=1024,height=1000,scrolling=True)
|
| 585 |
+
st.components.v1.html(uuu10,width=1024,height=1000,scrolling=True)
|
| 586 |
+
st.components.v1.html(uuu11,width=1024,height=568,scrolling=True)
|
| 587 |
+
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
|
| 591 |
+
# pl= "def hel()"
|
| 592 |
+
# code = st_ace(language='python',theme='dracula',placeholder=pl)
|
| 593 |
+
# '''def hello():
|
| 594 |
+
# print("Hello, Streamlit!")'''
|
| 595 |
+
# st.st_ace(code, language='python',theme='cobalt')
|
| 596 |
|
| 597 |
|
| 598 |
|