Spaces:
Sleeping
Sleeping
updated to suit v0.9a
Browse files
app.py
CHANGED
|
@@ -68,18 +68,16 @@ def run_code_with_inputs(code: str, inputs: str) -> str:
|
|
| 68 |
errors.append(processes[-1].stderr)
|
| 69 |
else:
|
| 70 |
outputs.append("""Could not compile the pseudocode.
|
| 71 |
-
Please check for
|
|
|
|
|
|
|
|
|
|
| 72 |
""")
|
| 73 |
|
| 74 |
if any(errors):
|
| 75 |
nl='\n'
|
| 76 |
return f"Error in Subprocess\nErrors:\n{nl.join(errors)}\n\nOutput:\n{nl.join(outputs)}"
|
| 77 |
|
| 78 |
-
# print(errors)
|
| 79 |
-
# print(outputs)
|
| 80 |
-
# ctime1 = os.path.getctime(pasfile)
|
| 81 |
-
# ctime2 = os.path.getctime(binfile)
|
| 82 |
-
# print(ctime1, ctime2, ctime1 < ctime2)
|
| 83 |
return outputs[-1]
|
| 84 |
|
| 85 |
except Exception as e:
|
|
@@ -88,7 +86,8 @@ Please check for syntax errors and undefined or misspelled identifiers/keywords.
|
|
| 88 |
# Define the Gradio interface
|
| 89 |
description = (
|
| 90 |
"""# Welcome to Pseudocode+!
|
| 91 |
-
### Pseudocode+ runs pseudocode based on the [CAIE Pseudocode Guide](https://www.cambridgeinternational.org/Images/697401-2026-pseudocode-guide-for-teachers.pdf), applicable for exams on 2025-2029.
|
|
|
|
| 92 |
)
|
| 93 |
|
| 94 |
with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_lg)) as demo:
|
|
@@ -99,7 +98,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_lg)) as de
|
|
| 99 |
OUTPUT "What is your name?"
|
| 100 |
INPUT yourname
|
| 101 |
OUTPUT "Hello, ",yourname,'!'
|
| 102 |
-
OUTPUT "You'
|
| 103 |
gr.Code(label="User Inputs", value='Alice\nBob', language=None, elem_id="input-box"),
|
| 104 |
],
|
| 105 |
outputs=gr.Code(
|
|
|
|
| 68 |
errors.append(processes[-1].stderr)
|
| 69 |
else:
|
| 70 |
outputs.append("""Could not compile the pseudocode.
|
| 71 |
+
Please check for the following kind of errors
|
| 72 |
+
> Syntax Error
|
| 73 |
+
> Undefined Identifiers/Keywords
|
| 74 |
+
> Wrong or Mismatched Spellings
|
| 75 |
""")
|
| 76 |
|
| 77 |
if any(errors):
|
| 78 |
nl='\n'
|
| 79 |
return f"Error in Subprocess\nErrors:\n{nl.join(errors)}\n\nOutput:\n{nl.join(outputs)}"
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
return outputs[-1]
|
| 82 |
|
| 83 |
except Exception as e:
|
|
|
|
| 86 |
# Define the Gradio interface
|
| 87 |
description = (
|
| 88 |
"""# Welcome to Pseudocode+!
|
| 89 |
+
### Pseudocode+ runs pseudocode based on the [CAIE Pseudocode Guide](https://www.cambridgeinternational.org/Images/697401-2026-pseudocode-guide-for-teachers.pdf), applicable for exams on 2025-2029.
|
| 90 |
+
If you find any errors, repo"""
|
| 91 |
)
|
| 92 |
|
| 93 |
with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_lg)) as demo:
|
|
|
|
| 98 |
OUTPUT "What is your name?"
|
| 99 |
INPUT yourname
|
| 100 |
OUTPUT "Hello, ",yourname,'!'
|
| 101 |
+
OUTPUT "You're using Pseudocode+ ",__version__,'.' """),
|
| 102 |
gr.Code(label="User Inputs", value='Alice\nBob', language=None, elem_id="input-box"),
|
| 103 |
],
|
| 104 |
outputs=gr.Code(
|