File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -568,6 +568,7 @@ This example shows how to use Judge0 Python SDK to:
5685682 . Read the files after the execution which were created during the execution.
569569
570570``` python
571+ # pip install judge0
571572import judge0
572573from judge0 import Filesystem, File, Submission
573574
@@ -601,6 +602,7 @@ print(result.post_execution_filesystem.find("./my_dir2/my_file2.txt"))
601602This example shows how to use Judge0 Python SDK with your own Judge0 instance.
602603
603604``` python
605+ # pip install judge0
604606import judge0
605607
606608client = judge0.Client(" http://127.0.0.1:2358" )
@@ -617,3 +619,24 @@ int main() {
617619result = judge0.run(client = client, source_code = source_code, language = judge0.C)
618620print (result.stdout)
619621```
622+
623+ ### Generating And Saving An Image File
624+
625+ ``` python
626+ # pip install judge0
627+ import judge0
628+
629+ source_code = """
630+ import matplotlib.pyplot as plt
631+
632+ plt.plot([x for x in range(10)], [x**2 for x in range(10)])
633+ plt.savefig("chart.png")
634+ """
635+
636+ result = judge0.run(source_code = source_code, language = judge0.PYTHON_FOR_ML )
637+
638+ image = result.post_execution_filesystem.find(" chart.png" )
639+ with open (image.name, " wb" ) as f:
640+ f.write(image.content)
641+ print (f " Generated image saved as: { image.name} \n " )
642+ ```
You can’t perform that action at this time.
0 commit comments