-
Notifications
You must be signed in to change notification settings - Fork 396
Add Dockerfile and Gradio Web UI #13
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for the fast PR, I really appreciate that. |
|
hm ?! |
| .dockerignore | ||
| .gitignore | ||
| *.md | ||
| Dockerfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker
Add containerized deployment with NVIDIA CUDA support and a Gradio-based web interface for easier usage. Based on community PR apple#13.
| RUN .venv/bin/pip install -r requirements.txt | ||
| RUN .venv/bin/pip install gradio | ||
| RUN ln -s /app/.venv/bin/sharp /usr/local/bin/sharp | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENV FORCE_CUDA="1"
RUN .venv/bin/pip install ninja
RUN .venv/bin/pip install -r requirements.txt
| "-i", input_path, | ||
| "-o", "/app/data/output", | ||
| "--render" | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd = [
"sharp", "predict",
"-i", input_path,
"-o", "/app/data/output",
"--render"
]
| print(f"Error running sharp: {e}") | ||
| print(f"Stdout: {e.stdout.decode()}") | ||
| print(f"Stderr: {e.stderr.decode()}") | ||
| return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try:
t = time.time()
print("Sharp started")
subprocess.run(cmd, check=True, capture_output=True)
print(f"Sharp command took {round(time.time() - t, 3)} seconds")
except subprocess.CalledProcessError as e:
print(f"Error running sharp: {e}")
print(f"Stdout: {e.stdout.decode()}")
print(f"Stderr: {e.stderr.decode()}")
return None
This PR introduces a Dockerfile and compose.yml to simplify installation.
It also adds gradio_web.py to provide a web-based interface for improved usability.