Git Product home page Git Product logo

flowfunc's People

Contributors

idling-mind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flowfunc's Issues

Connect nodes with different types

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?

Fix basic usage example bugs

My development environment is:

  • Windows 10
  • python 3.7.9
  • dash 2.0

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:

  • pip install typing_extensions
  • modify flowfunc\config.py

Modify flowfunc\config.py as the flowing:

  • delete one line:

from typing import Any, Callable, List, Optional, Union, get_args, get_origin

  • add these lines:
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!

Install flowfunc without git on Windows 10

I do not have git installed on Windows 10. An alternative that avoids git is to install from a zip. I install flowfunc successfully:

  1. download code zip, flowfunc-master.zip placed in my dowload dir
  2. pip install /Users/chenxiaowang/Downloads/flowfunc-master.zip

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.

Upload files in nodes

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.

License

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.

pydantic version is incompatible with some existing packages (thinc and spacy)

flowfunc requires pydantic>=1.9 ( pydantic-1.10.2 installed) is incompatible with existing packages of my app:

  • 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.
  • 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.

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.

ControlType.multiselect doesn't seem to work

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')

Can not input float data type

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.