tiahchia commited on
Commit
e367e85
·
verified ·
1 Parent(s): 0ad4bec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -3,7 +3,7 @@ import html
3
  import io
4
  from contextlib import redirect_stdout
5
 
6
- # Python runner with real terminal output
7
  def run_python(code):
8
  f = io.StringIO()
9
  try:
@@ -27,7 +27,7 @@ def run_code(code, lang):
27
 
28
  # Starter templates
29
  starter_python = """# Python example
30
- print("Hello from Python!")
31
  for i in range(5):
32
  print(f"Line {i+1}")"""
33
 
@@ -46,13 +46,13 @@ h1 { color:#F714C5; text-align:center; }
46
 
47
  with gr.Blocks(css=f"""
48
  body {{ margin:0; padding:0; font-family:'Poppins', sans-serif; background:#121212; color:#e0e0e0; }}
49
- .gradio-container {{ max-width:1200px; margin:auto; padding:20px; }}
50
  .gr-row {{ display:flex; gap:20px; margin-top:20px; }}
51
- .output-panel {{ flex:1; background:#1e1e1e; border-radius:8px; box-shadow:0 4px 8px rgba(0,0,0,0.5); height:500px; padding:16px; font-family: monospace; color: #00ff00; white-space: pre-wrap; overflow:auto; }}
52
- .gr-textbox textarea {{ font-family: monospace; background:#1e1e1e; color:#e0e0e0; border:none; border-radius:8px; padding:16px; height:500px; overflow:auto; }}
53
  .gr-radio {{ color:#e0e0e0; margin-bottom:16px; }}
54
  button, .gr-button {{ background-color:#F714C5 !important; color:#fff !important; border-radius:6px !important; padding:10px 20px !important; }}
55
- footer {{ display:none !important; }} /* Hide Gradio footer */
56
  header {{ background:#000000; padding:16px; color:#F714C5; font-size:1.6em; text-align:center; margin-top:20px; }}
57
  header img {{ vertical-align:middle; height:20px; margin-right:8px; }}
58
  """) as demo:
@@ -66,12 +66,12 @@ header img {{ vertical-align:middle; height:20px; margin-right:8px; }}
66
 
67
  # Editor + Output side by side
68
  with gr.Row():
69
- code_input = gr.Textbox(
70
- lines=20,
71
  value=starter_web,
 
72
  label="Type your code here",
73
- placeholder="Start coding...",
74
  interactive=True,
 
75
  )
76
  output_frame = gr.HTML(label="Output", elem_id="output-panel")
77
 
 
3
  import io
4
  from contextlib import redirect_stdout
5
 
6
+ # Python runner with terminal output
7
  def run_python(code):
8
  f = io.StringIO()
9
  try:
 
27
 
28
  # Starter templates
29
  starter_python = """# Python example
30
+ print("Hello World!")
31
  for i in range(5):
32
  print(f"Line {i+1}")"""
33
 
 
46
 
47
  with gr.Blocks(css=f"""
48
  body {{ margin:0; padding:0; font-family:'Poppins', sans-serif; background:#121212; color:#e0e0e0; }}
49
+ .gradio-container {{ max-width:1600px; margin:auto; padding:20px; }}
50
  .gr-row {{ display:flex; gap:20px; margin-top:20px; }}
51
+ .output-panel {{ flex:1; background:#1e1e1e; border-radius:8px; box-shadow:0 4px 8px rgba(0,0,0,0.5); height:600px; padding:16px; font-family: monospace; color: #00ff00; white-space: pre-wrap; overflow:auto; }}
52
+ #editor-container .CodeMirror {{ height:600px; border-radius:8px; font-family: monospace; font-size:14px; }}
53
  .gr-radio {{ color:#e0e0e0; margin-bottom:16px; }}
54
  button, .gr-button {{ background-color:#F714C5 !important; color:#fff !important; border-radius:6px !important; padding:10px 20px !important; }}
55
+ footer {{ display:none !important; }}
56
  header {{ background:#000000; padding:16px; color:#F714C5; font-size:1.6em; text-align:center; margin-top:20px; }}
57
  header img {{ vertical-align:middle; height:20px; margin-right:8px; }}
58
  """) as demo:
 
66
 
67
  # Editor + Output side by side
68
  with gr.Row():
69
+ code_input = gr.Code(
 
70
  value=starter_web,
71
+ language="html",
72
  label="Type your code here",
 
73
  interactive=True,
74
+ lines=25,
75
  )
76
  output_frame = gr.HTML(label="Output", elem_id="output-panel")
77