Project Info
This project did not submit a demo video on Devpost.
Inspiration
As CS Students, math enthusiasts and amateur researches, we know the struggle and the beauty of watching code become artistic, organized writing. Yet, it is so difficult to become comfortable without extensive experience. We hope to enable anyone to quickly form perfect documents, quickly and intuitively.
What it does
The crux of our application is a Fine-Tuned LLM Copilot, OCR for handwritten math, and custom commands integrated with a blazingly fast native LaTeX IDE and Renderer in browser. We have built in commands for common things like logical-and, logical-or, and even Demorgans Law so that your paper or proof shouldn’t be hindered by a curly bracket. The main part of our product is an AI model using Together.ai with CodeLlama-2 trained on a large data set of 450 common prompts in Discrete Math and research papers. A prompt like “create a bullet point for my education section on my resume at the Stanford” would spit a perfectly formatted block of latex in our proprietary IDE. Or “perform DeMorgans law on Set A and Set B”. This is chips and guac for us. Have messy handwritten math? No problem at all!
How we built it
The backend was built using a TexLive renderer in a Docker container that is run to consistently render the Tex Document continuously so you can see your changes “live”. The frontend was built with Typescript + React with Vite, and the backend with FastAPI, Firebase Auth for authentication, and Postgres for database storage so that users can save to the cloud in the future. This was used in tandem with Monaco Editor from Microsoft for all the logic we embedded to deal with the autocomplete and code snippet replacement commands. For the ML Model we trained it using Together.ai for a fine-tuned CodeLlama-2. For OCR, we leveraged MathPix APIs.
Challenges we ran into
We found no shortage of challenges. Our biggest issue was giving the ML model permission to write into the IDE as the package configurations coupled with the extensive setup for the Tex Renderer to take this input. We decided to approach it using custom commands (such as /ai) to give the user command over when they want to get help. It was quite the challenge. Of course, building the container and integrating it with the backend was no small feat either. We put these different puzzle pieces together and realized there was more color to the bigger picture than we anticipated.
Accomplishments we're proud of
We are most proud of creating an integrated IDE. None of us have experience making developer tools so we were very proud with how we learned the tech to power our application. The key thing is in Monaco Editor Latex was not a supported language compatible with the IDE. As such we had to bruteforce produce mappings of the key words like \textbf{} and link smart highlighting with the intellisense that runs Monaco Editor to get a fully functioning IDE tailored to our use cases. As an extension we are especially proud of our Latex CoPilot. Utilizing Together to integrate a smart AI code generator that intakes English semantic was an enriching experience to accomplish, especially building the model from the ground up and linking it to the IDE.
What we learned
We see ourselves enhancing the ML model to implement more tailored Tex code and even make suggestions based on what the user wants. Furthermore, we see ourselves implementing our own syntactical language that overlaps Tex that makes it more user friendly maintaining a consistent lexical structure throughout, as to interpreting English input and immediately translating it into Tex. Finally, Nonetheless, we enjoyed this project and were able to see the fruit of our work taking our old Discrete Math work and research papers being written in this app of ours.
What's next
We see ourselves enhancing the ML model to implement more tailored Tex code and even make suggestions based on what the user wants. Furthermore, we see ourselves implementing our own syntactical language that overlaps Tex that makes it more user friendly maintaining a consistent lexical structure throughout, as to interpreting English input and immediately translating it into Tex. We also intend to add cloud storage for users. Nonetheless, we enjoyed this project and were able to see the fruit of our work taking our old Discrete Math work and research papers being written in this app of ours.
Latex AI Dev Guide
FastAPI Server Setup
FastAPI is a modern, fast web framework for building APIs with Python 3.7+ based on standard Python type hints.
Steps
-
Clone the Repository
Ensure you have the project repository cloned to your local machine.
-
Setup Poetry Environment
Install Poetry with
pipx install poetryNaviagate to
backendand runpoetry installand thenpoetry shell -
Run Server Now, in the root dir, run
uvicorn backend.main:app --reload
Vite Server Setup
Vite is a modern frontend build tool that provides a faster and leaner development experience.
Steps
-
Navigate…
…to
client. -
Install npm
Install
npmwithnpm install -
Run Server Now, run
npm run dev
Analysis
View
Metric
- 24
- 22
- 6
- 5
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- HTMLIn code
- JavaScriptIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
- FirebaseClaimed
- PostgreSQLClaimed
8 of 10 appear in the indexed code. 2 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
88 KB
Source files
41
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
derekmil/treehacks-2024
57 files · 1.5 MB · @ ba1fc89
Structure
Interface
21 files · 37%Screens, components and styles rendered to the user.
Application logic
14 files · 25%Domain rules, services and shared utilities.
Data & schema
2 files · 4%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript79%
- Python13%
- JavaScript3%
- Markdown2%
- CSS2%
- HTML0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
client/package.json
npm · 43- @monaco-editor/react
- @radix-ui/react-dialog
- @radix-ui/react-dropdown-menu
- @radix-ui/react-hover-card
- @radix-ui/react-icons
- @radix-ui/react-navigation-menu
- @radix-ui/react-scroll-area
- @radix-ui/react-separator
- @radix-ui/react-slot
- @radix-ui/react-tooltip
- @react-pdf/renderer
- @tanstack/react-query
- class-variance-authority
- clsx
- cmdk
- localforage
- lodash
- lucide-react
- +25 more
backend/pyproject.toml
pypi · 9- fastapi
- firebase-admin
- psycopg2-binary
- pyrebase4
- python-dotenv
- python-multipart
- setuptools
- sqlalchemy
- uvicorn
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.