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

Run the program without gradio #35

Open
oxygen-berry opened this issue May 23, 2024 · 1 comment
Open

Run the program without gradio #35

oxygen-berry opened this issue May 23, 2024 · 1 comment

Comments

@oxygen-berry
Copy link

Dear sir, I want to run the program directly locally, that is, input the image and output the segmented and marked image without using Gradio to generate the website. Is there any corresponding file? I try to modify the demo_som.py file, but I always get an error because of these two lines.
_image = image['background'].convert('RGB') _mask = image['layers'][0].convert('L') if image['layers'] else None
Can you give me some tips please?Thank you.

@abrichr
Copy link
Contributor

abrichr commented May 24, 2024

If you're getting an error there, you're most likely using an outdated version of gradio. Make sure to pip install gradio==4.17.0 as per the Dockerfile.

Regarding running the project without gradio, you can take a look at how https://github.com/microsoft/SoM/blob/main/demo_som.py#L109 and https://github.com/microsoft/SoM/blob/main/demo_gpt4v_som.py#L131 are implemented, i.e. with calls to inference_semsam_m2m_auto, inference_sam_m2m_auto, etc.

The easiest way to use the project is with deploy.py. If you don't want to run it on EC2, you can simply follow the commands in the script section of https://github.com/microsoft/SoM/blob/main/docker-build-ec2.yml.j2#L25. Running this locally would look something like this:

            # Build the image
            sudo nvidia-docker build -t som .

            # Run the image
            sudo docker run -d -p 6092:6092 --gpus all --name som-container som

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

2 participants