remove print statements
Browse files94 unmodified lines959697989910010110210310410510610736 unmodified lines14414514614714814915019 unmodified lines17017117217317417517694 unmodified linesmatch = re.search(pattern, text, re.DOTALL)if match:extracted = match.group(1).strip()print("Successfully extracted code block:", extracted)return extracted# If no code block is found, check if the entire text is HTMLif text.strip().startswith('<!DOCTYPE html>') or text.strip().startswith('<html'):print("Text appears to be raw HTML, using as is")return text.strip()print("No code block found in text:", text)return text.strip()def history_render(history: History):36 unmodified linesencoded_html = base64.b64encode(wrapped_code.encode('utf-8')).decode('utf-8')data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"iframe = f'<iframe src="{data_uri}" width="100%" height="920px" sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation" allow="display-capture"></iframe>'print("Generated iframe:", iframe)return iframedef demo_card_click(e: gr.EventData):19 unmodified linesreturn DEMO_LIST[index]['description']except (KeyError, IndexError, AttributeError) as e:print(f"Error in demo_card_click: {e}")# Return the first demo description as fallbackreturn DEMO_LIST[0]['description']94 unmodified lines959697989910010110210310436 unmodified lines14114214314414514619 unmodified lines16616716816917017194 unmodified linesmatch = re.search(pattern, text, re.DOTALL)if match:extracted = match.group(1).strip()return extracted# If no code block is found, check if the entire text is HTMLif text.strip().startswith('<!DOCTYPE html>') or text.strip().startswith('<html'):return text.strip()return text.strip()def history_render(history: History):36 unmodified linesencoded_html = base64.b64encode(wrapped_code.encode('utf-8')).decode('utf-8')data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"iframe = f'<iframe src="{data_uri}" width="100%" height="920px" sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-presentation" allow="display-capture"></iframe>'return iframedef demo_card_click(e: gr.EventData):19 unmodified linesreturn DEMO_LIST[index]['description']except (KeyError, IndexError, AttributeError) as e:# Return the first demo description as fallbackreturn DEMO_LIST[0]['description']
app.py-5