Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning text & images to editor as well as audio #25

Open
drscotthawley opened this issue Aug 17, 2024 · 1 comment
Open

Returning text & images to editor as well as audio #25

drscotthawley opened this issue Aug 17, 2024 · 1 comment

Comments

@drscotthawley
Copy link

Dear Hugo et al,

I have a gradio app that reads some audio and produces text and analysis graphs of it. (It doesn't actually change the audio.)
It was looking like I could use PyHARP v0.1.0 to integrate my gradio app with a DAW, and just return the original audio unaltered so it didn't affect the DAW, as well as return my graph and text.
build_endpoint took four arguments (inputs, output, process_fn, card).

But now with v 0.1.1, inputs & output are together in "components". In this new framework, how can I setup an additional output to display in HARP, e.g. of type gr.Image?

Thanks!

@drscotthawley
Copy link
Author

drscotthawley commented Aug 17, 2024

Ah, ok I modified the source, build_endpoint in core.py to accept an extra kwarg for optional outputs, e.g.

def build_endpoint(model_card: ModelCard, components: list, process_fn: callable, out_img=None) -> tuple:

(where out_img is already initialized as type `gr.Image(type="filepath") and then later

      outputs=[out, out_img] if out_img is not None else [out],

...the whole thing runs fine.

However, since HARP itself doesn't seem to support the extra image display, the image return by the gradio demo just gets ignored 😢
it would be cool if HARP were to support such things, but I understand that this is not most people's intended use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant