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

fix agent name calculation for gradio app #812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sysradium
Copy link
Contributor

@sysradium sysradium commented Feb 26, 2025

Fixes this issue:

Traceback (most recent call last):
  File "/Users/user/Documents/Dev/sysradium/ml-playground/agents/smol_example.py", line 163, in <module>
    demo = GradioUI(agent).create_app()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Documents/Dev/sysradium/ml-playground/.venv/lib/python3.12/site-packages/smolagents/gradio_ui.py", line 270, in create_app
    f"# {self.name.replace('_', ' ').capitalize() or 'Agent interface'}"

Name is optional and thus by default is None:

self.name = name

Also if name is not event specified it is None as well:
https://github.com/huggingface/smolagents/blob/main/src/smolagents/gradio_ui.py#L187
Hence the bugfix.

Maybe we can consider using this instead:
https://github.com/huggingface/smolagents/blob/main/src/smolagents/agents.py#L205

Copy link
Collaborator

@aymeric-roucher aymeric-roucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sysradium !

@aymeric-roucher
Copy link
Collaborator

Make sure to run ruff formatting @sysradium !

@sysradium sysradium force-pushed the name-generation-gradio-bugfix branch from 00bd634 to fb455d9 Compare March 3, 2025 15:24
@sysradium
Copy link
Contributor Author

@aymeric-roucher it complaints about a file which is not changed ... Weird. I rebased. I ran formatting locally just in 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

Successfully merging this pull request may close these issues.

2 participants