Spaces:
Build error
Build error
Download app.py from aaronxavier/lin-alg: direct link, hf CLI and curl.
- Browser
- Download file 868 Bytes
-
https://huggingface.co/spaces/aaronxavier/lin-alg/resolve/main/app.py
- Command line
-
hf download hf://spaces/aaronxavier/lin-alg/app.py
-
curl -L -o app.py https://huggingface.co/spaces/aaronxavier/lin-alg/resolve/main/app.py
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() | |