reorder tabs
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import visual
|
3 |
import gen
|
4 |
-
import subprocess
|
5 |
-
import sys
|
6 |
|
7 |
def showpuzzle(encoding):
|
8 |
p1 = visual.parse(encoding)
|
@@ -34,19 +32,6 @@ def shuffle(encoding,show):
|
|
34 |
|
35 |
shufint = gr.Interface(fn=shuffle, inputs=[gr.Text(label="Puzzle encoding"),gr.Checkbox(label="Visualise")], outputs=[gr.Plot(label="Visualisation"),gr.Text(label="Shuffled encoding")])
|
36 |
|
37 |
-
def sendcommand(function,args):
|
38 |
-
process = subprocess.run(["ghc", "Challenges.hs", "-e", f'{function} {args}' ], check=True, capture_output=True)
|
39 |
-
return process.stdout.decode(sys.stdout.encoding).strip()
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
def runtests():
|
44 |
-
output = subprocess.run(["runghc", "../Tests.hs"],check=True,capture_output=True).stderr.decode(sys.stdout.encoding).strip()
|
45 |
-
if output == "":
|
46 |
-
return "All tests passed"
|
47 |
-
return output
|
48 |
-
|
49 |
-
testint = gr.Interface(fn=runtests, inputs=None, outputs='text', description="runs automated tests from Tests.hs (will not work on huggingface)")
|
50 |
-
|
51 |
-
demo = gr.TabbedInterface([showpuzzint,genint,shufint],["visualise","generate","shuffle"],title="comp2209 Tools")
|
52 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import visual
|
3 |
import gen
|
|
|
|
|
4 |
|
5 |
def showpuzzle(encoding):
|
6 |
p1 = visual.parse(encoding)
|
|
|
32 |
|
33 |
shufint = gr.Interface(fn=shuffle, inputs=[gr.Text(label="Puzzle encoding"),gr.Checkbox(label="Visualise")], outputs=[gr.Plot(label="Visualisation"),gr.Text(label="Shuffled encoding")])
|
34 |
|
|
|
|
|
|
|
35 |
|
36 |
+
demo = gr.TabbedInterface([genint,showpuzzint,shufint],["generate","visualise","shuffle"],title="comp2209 Tools")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
demo.launch()
|