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

TabbedInterface bug: Second Tab Running Logic of First Tab #8620

Closed
1 task done
amanmibra opened this issue Jun 25, 2024 · 1 comment
Closed
1 task done

TabbedInterface bug: Second Tab Running Logic of First Tab #8620

amanmibra opened this issue Jun 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@amanmibra
Copy link

Describe the bug

I have a gradio app with two functions for seperate purposes. When running the Interfaces in isolation, they work as expected. When I put them in the TabbedInterface, which ever tab is put first works fine, but the second one always begins running the logic of the first. Again, this happens no matter which of the interfaces I put first, the second tab always runs the others logic.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

# slightly edited from original source code
import gradio as gr

def a(audio):
  # not sharing source code
  print('foo')
  
def b(audio):
  print('bar')

a_demo = gr.Interface(
   a,
    "audio",
    "audio",
)

b_demo = gr.Interface(
    b,
    "audio",
    [gr.Number(label="Watermark Score (0-1)"), gr.Textbox(label="Watermark Message")],
 
)


demo = gr.TabbedInterface(
    [a_demo, b_demo],
    ["A Demo", "B Demo"],
)


def get_args():
    parser = argparse.ArgumentParser(description="Run the watermarking application")
    parser.add_argument(
        "--a", action="store_true", help="Launch only the watermark demo"
    )
    parser.add_argument(
        "--b", action="store_true", help="Launch only the check watermark demo"
    )
    parser.add_argument(
        "--port",
        type=int,
        default=7860,
        help="Specify the port number for the server to run on",
    )
    return parser.parse_args()


def main():
    args = get_args()
    if args.a:
        a_demo.launch(
            show_error=True, debug=True, server_port=args.port, share=True
        )
    elif args.b:
       b_demo.launch(
            show_error=True, debug=True, server_port=args.port, share=True
        )
    else:
        demo.launch(show_error=True, server_port=args.port)

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 4.33.0
gradio_client version: 0.17.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.111.0
ffmpy: 0.3.2
gradio-client==0.17.0 is not installed.
httpx: 0.27.0
huggingface-hub: 0.23.2
importlib-resources: 6.4.0
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.9.0
numpy: 1.26.4
orjson: 3.10.3
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.3
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.7
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.12.1
urllib3: 2.2.1
uvicorn: 0.30.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.6.0
httpx: 0.27.0
huggingface-hub: 0.23.2
packaging: 24.0
typing-extensions: 4.12.1
websockets: 11.0.3


### Severity

I can work around it
@amanmibra amanmibra added the bug Something isn't working label Jun 25, 2024
@abidlabs
Copy link
Member

Hi @amanmibra this issue has been fixed in the latest version of gradio -- can you please upgrade to 4.37.1?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants