lin-alg / app.py
Aaron Xavier
Final commit before deploy
65c63f5
Raw
History Blame Contribute Delete
868 Bytes
import gradio as gr
from helper import *
from main import is_intersecting
def result(l1,l2):
if is_intersecting(l1,l2):
return f"The lines are intersecting"
else:
return f"The lines are not intersecting"
def pack(x1, y1, x2, y2, x3, y3, x4, y4):
p1 = Point()
p2 = Point()
p1.make_point(x1, y1)
p2.make_point(x2, y2)
l1 = Line()
l1.make_line(p1,p2)
p3 = Point()
p4 = Point()
p3.make_point(x3, y3)
p4.make_point(x4, y4)
l2 = Line()
l2.make_line(p3,p4)
return result(l1,l2)
demo = gr.Interface(
fn=pack,
inputs=[
gr.Number(label="x1"), gr.Number(label="y1"),
gr.Number(label="x2"), gr.Number(label="y2"),
gr.Number(label="x3"), gr.Number(label="y3"),
gr.Number(label="x4"), gr.Number(label="y4")
],
outputs="text"
)
demo.launch()