Skip to content

Commit

Permalink
preparing for distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
rsamf committed Sep 10, 2024
1 parent b25897c commit e6d5c4e
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 5 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish Plugin to PyPI

on:
workflow_dispatch:

jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build and Publish
run: |
cd web
npm install
npm run build
poetry build
poetry publish -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.TEST_PYPI_PASSWORD }}
25 changes: 25 additions & 0 deletions .github/workflows/test-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Plugin to Test PyPI

on:
workflow_dispatch:

jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Set up Test PyPI Repository
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
- name: Build and Publish
run: |
cd web
npm install
npm run build
poetry build
poetry publish -r test-pypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.TEST_PYPI_PASSWORD }}
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# graphbook-huggingface
The huggingface plugin for Graphbook
<p align="center">
<a href="https://graphbook.ai">
<img src="https://github.com/graphbookai/graphbook/blob/main/docs/_static/graphbook.png?raw=true" alt="Logo" width=256>
</a>

<h1 align="center">Graphbook Huggingface</h1>

<p align="center">
A Huggingface Plugin to drag-and-drop models and datasets onto Graphbook workflows
</p>
</p>

This plugin contains a web panel for searching and drag-and-dropping models and datasets from [Huggingface Hub](https://huggingface.co/) onto their graphbook workflows.
It also contains the following nodes:

* `HuggingfacePipeline` for model usage from transformers package
* `HuggingfaceDataset` for dataset usage from the datasets package
* `AssignModelOutputsToNotes` to assign HF model outputs to incoming Notes

## Getting started
1. `pip install graphbook_huggingface`
1. `graphbook --config hf.config.yaml`

2 changes: 1 addition & 1 deletion graphbook_huggingface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
export("HuggingfaceDataset", HuggingfaceDataset)
export("AssignModelOutputsToNotes", AssignModelOutputsToNotes)

web(osp.realpath(osp.join(osp.dirname(__file__), "../web/dist/bundle.js")))
web(osp.realpath(osp.join(osp.dirname(__file__), "./dist/bundle.js")))
2 changes: 2 additions & 0 deletions hf.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plugins:
- graphbook_huggingface
3 changes: 2 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js --mode development"
"build:dev": "webpack --config webpack.config.js --mode development",
"build": "webpack --config webpack.config.js --mode production"
},
"author": "",
"license": "ISC",
Expand Down
2 changes: 1 addition & 1 deletion web/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
entry: './src/main.tsx',
output: {
filename: 'bundle.js',
filename: '../../graphbook_huggingface/dist/bundle.js',
library: {
type: 'module'
},
Expand Down

0 comments on commit e6d5c4e

Please sign in to comment.