akhaliq HF Staff commited on
Commit
41e409d
·
1 Parent(s): c7dcb04

remove print statements

Browse files
Files changed (1) hide show
  1. app.py +0 -5
app.py CHANGED
@@ -95,13 +95,10 @@ def remove_code_block(text):
95
  match = re.search(pattern, text, re.DOTALL)
96
  if match:
97
  extracted = match.group(1).strip()
98
- print("Successfully extracted code block:", extracted)
99
  return extracted
100
  # If no code block is found, check if the entire text is HTML
101
  if text.strip().startswith('<!DOCTYPE html>') or text.strip().startswith('<html'):
102
- print("Text appears to be raw HTML, using as is")
103
  return text.strip()
104
- print("No code block found in text:", text)
105
  return text.strip()
106
 
107
  def history_render(history: History):
@@ -144,7 +141,6 @@ def send_to_sandbox(code):
144
  encoded_html = base64.b64encode(wrapped_code.encode('utf-8')).decode('utf-8')
145
  data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
146
  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>'
147
- print("Generated iframe:", iframe)
148
  return iframe
149
 
150
  def demo_card_click(e: gr.EventData):
@@ -170,7 +166,6 @@ def demo_card_click(e: gr.EventData):
170
 
171
  return DEMO_LIST[index]['description']
172
  except (KeyError, IndexError, AttributeError) as e:
173
- print(f"Error in demo_card_click: {e}")
174
  # Return the first demo description as fallback
175
  return DEMO_LIST[0]['description']
176
 
 
95
  match = re.search(pattern, text, re.DOTALL)
96
  if match:
97
  extracted = match.group(1).strip()
 
98
  return extracted
99
  # If no code block is found, check if the entire text is HTML
100
  if text.strip().startswith('<!DOCTYPE html>') or text.strip().startswith('<html'):
 
101
  return text.strip()
 
102
  return text.strip()
103
 
104
  def history_render(history: History):
 
141
  encoded_html = base64.b64encode(wrapped_code.encode('utf-8')).decode('utf-8')
142
  data_uri = f"data:text/html;charset=utf-8;base64,{encoded_html}"
143
  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>'
 
144
  return iframe
145
 
146
  def demo_card_click(e: gr.EventData):
 
166
 
167
  return DEMO_LIST[index]['description']
168
  except (KeyError, IndexError, AttributeError) as e:
 
169
  # Return the first demo description as fallback
170
  return DEMO_LIST[0]['description']
171