idling-mind / flowfunc Goto Github PK
View Code? Open in Web Editor NEWA web-based node editor component for plotly dash
Home Page: https://najeem.pythonanywhere.com/
License: MIT License
A web-based node editor component for plotly dash
Home Page: https://najeem.pythonanywhere.com/
License: MIT License
which python version are you using?
How to prevent users from connecting nodes that aren't with the same type,
for example, prevent user to connect a str output to an int input?
My development environment is:
When I run the basic usage example from https://github.com/idling-mind/flowfunc#readme:
C:\Users\chenxiaowang\dash-apps\flowfunc-master\learn>ppython basic_usage.py
Traceback (most recent call last):
File "basic_usage.py", line 5, in
from flowfunc.config import Config
File "C:\Panda3D-1.10.10-x64\python\lib\site-packages\flowfunc\config.py", line 5, in
from typing import Any, Callable, List, Optional, Union, get_args, get_origin
ImportError: cannot import name 'get_args' from 'typing' (C:\Panda3D-1.10.10-x64\python\lib\typing.py)
I fixed it:
Modify flowfunc\config.py as the flowing:
from typing import Any, Callable, List, Optional, Union, get_args, get_origin
from typing import Any, Callable, List, Optional, Union
try:
from typing import get_args
except ImportError:
from typing_extensions import get_args
try:
from typing import get_args
except ImportError:
from typing_extensions import get_args
I aslo modify basic uasage exmaple code:
@app.callback(
Output("output", "children"),
Input("btn_run", "n_clicks"),
State("nodeeditor", "nodes"),
#prevent_initial_callbacks=False
)
def run_nodes(nclicks: int, output_nodes: Dict[str, OutNode]):
"""Run the node layout"""
# The result is a dictionary of OutNode objects
# check output_nodes is None
if output_nodes is None:
return []
result = runner.run(output_nodes)
output = []
for node in result.values():
# node.result contains the result of the node
output.append(
html.Div([html.H1(f"{node.type}: {node.id}"), html.P(str(node.result))])
)
return output
if __name__ == "__main__":
# AttributeError: 'Dash' object has no attribute 'run'
##app.run()
app.run_server(debug = True, host = '192.168.0.114', use_reloader=False, dev_tools_hot_reload=False)
The basic usage example has run successfully on my development environment. VERY COOL!
I do not have git installed on Windows 10. An alternative that avoids git is to install from a zip. I install flowfunc successfully:
Processing c:\users\chenxiaowang\downloads\flowfunc-master.zip
Preparing metadata (setup.py) ... done
Collecting pydantic>=1.9
Downloading pydantic-1.10.2-cp37-cp37m-win_amd64.whl (2.1 MB)
---------------------------------------- 2.1/2.1 MB 1.7 MB/s eta 0:00:00
Requirement already satisfied: typing-extensions>=4.1.0 in c:\panda3d-1.10.10-x64\python\lib\site-packages (from pydantic>=1.9->flowfunc==0.0.1) (4.4.0)
Building wheels for collected packages: flowfunc
Building wheel for flowfunc (setup.py) ... done
Created wheel for flowfunc: filename=flowfunc-0.0.1-py3-none-any.whl size=53531 sha256=c506f66d3cf16ccb594092b6d198b08cde50547a242c6886a988e8be5ac51ba3
Stored in directory: c:\users\chenxiaowang\appdata\local\pip\cache\wheels\06\fb\c5\9e421df97a7ea694d83cceff236fc4b23973d10c7cb0ef478d
Successfully built flowfunc
Installing collected packages: pydantic, flowfunc
Attempting uninstall: pydantic
Found existing installation: pydantic 1.8.2
Uninstalling pydantic-1.8.2:
Successfully uninstalled pydantic-1.8.2
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
thinc 8.0.15 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 1.10.2 which is incompatible.
thinc 8.0.15 requires typing-extensions<4.0.0.0,>=3.7.4.1; python_version < "3.8", but you have typing-extensions 4.4.0 which is incompatible.
spacy 3.2.4 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 1.10.2 which is incompatible.
spacy 3.2.4 requires typing-extensions<4.0.0.0,>=3.7.4; python_version < "3.8", but you have typing-extensions 4.4.0 which is incompatible.
Successfully installed flowfunc-0.0.1 pydantic-1.10.2
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the 'c:\panda3d-1.10.10-x64\python\python.exe -m pip install --upgrade pip' command.
Is it possible to have upload and download nodes for different file types like images, audio etc?
I know there were upload and download buttons in the sample project, but I wanted to use it as a node in the graph instead of downloading/uploading a graph.
Really awesome work! Thank you!
I saw that you don't provide a license (yet). Are there plans to add one? Otherwise, it might be problematic for some folks (like me ๐ ) to use your package.
flowfunc requires pydantic>=1.9 ( pydantic-1.10.2 installed) is incompatible with existing packages of my app:
I have to solve these dependency conflicts.
After all, I have successfully installed flowfunc-0.0.1 and pydantic-1.10.2.
Next, run the basic usage example.
I want to make a node with a sting input and a dropdown to choose a value.
how should i go about it?
def function1(name:str, drop_downlist)->str:
something = process(name, choice)
return something
Problems setting ControlType.multiselect
just changed type = ControlType.multiselect in the code from Upload files in nodes #13
`
def file_selector(infile):
return infile
file_selector_control = Control(
type= ControlType.multiselect,
name="file_selector",
label="Select a File",
options=[
# List your files in here. Create this dictionary from the uploaded files.
{"value": "file1.txt", "label": "this is file 1"},
{"value": "file2.txt", "label": "this is file 2"},
],
)
file_selector_port = Port(
type="file_selector",
name="infile",
label="Select File",
controls=[file_selector_control],
)
file_selector_node = Node(
type="file_selector",
label="File Selector",
method=file_selector,
inputs=[file_selector_port],
outputs=[file_selector_port],
)
fconfig = Config.from_function_list(
all_functions,
extra_nodes=[file_selector_node],
extra_ports=[file_selector_port]
)
`
Generates error in browser: Cannot read properties of undefined (reading 'length')
Define a function:
def add_int_float(
a: int, b: float
) -> float:
return a + b
and run:
methods_dao.add_int_float: None
1 validation error for AddIntFloat b field required (type=value_error.missing)
None Control component provided for input b with data type float.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.