Jacob Logas
commited on
Commit
·
181c2cc
1
Parent(s):
633865a
Fix all the broken things... so far
Browse files- Dockerfile +4 -1
- app.py +4 -3
Dockerfile
CHANGED
|
@@ -9,7 +9,7 @@ RUN python -m pip install --upgrade pip && \
|
|
| 9 |
pip install --no-cache-dir --no-warn-script-location --user typing-extensions -U
|
| 10 |
|
| 11 |
# Stage 2: Runtime
|
| 12 |
-
FROM nvidia/cuda:11.3
|
| 13 |
|
| 14 |
RUN rm /etc/apt/sources.list.d/cuda.list
|
| 15 |
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
|
|
@@ -26,5 +26,8 @@ RUN apt update && \
|
|
| 26 |
apt clean && rm -rf /var/lib/apt/lists/*
|
| 27 |
COPY --from=builder /root/.local/lib/python3.7/site-packages /usr/local/lib/python3.7/dist-packages
|
| 28 |
COPY app.py app.py
|
|
|
|
|
|
|
|
|
|
| 29 |
CMD ["python3", "app.py"]
|
| 30 |
EXPOSE 7860
|
|
|
|
| 9 |
pip install --no-cache-dir --no-warn-script-location --user typing-extensions -U
|
| 10 |
|
| 11 |
# Stage 2: Runtime
|
| 12 |
+
FROM nvidia/cuda:11.0.3-cudnn8-runtime
|
| 13 |
|
| 14 |
RUN rm /etc/apt/sources.list.d/cuda.list
|
| 15 |
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
|
|
|
|
| 26 |
apt clean && rm -rf /var/lib/apt/lists/*
|
| 27 |
COPY --from=builder /root/.local/lib/python3.7/site-packages /usr/local/lib/python3.7/dist-packages
|
| 28 |
COPY app.py app.py
|
| 29 |
+
|
| 30 |
+
# RUN ln -s /usr/local/cuda/lib64/libcusolver.so.11 /usr/local/cuda/lib64/libcusolver.so.10
|
| 31 |
+
|
| 32 |
CMD ["python3", "app.py"]
|
| 33 |
EXPOSE 7860
|
app.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
from fawkes.protection import Fawkes
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
def predict(level, img):
|
| 5 |
# print(img)
|
| 6 |
fwks = Fawkes("extractor_2", '0', 1, mode=level)
|
| 7 |
fwks.run_protection([img], format='jpeg')
|
| 8 |
splt = img.split(".")
|
| 9 |
-
|
| 10 |
-
return splt[0] + "_cloaked."
|
| 11 |
|
| 12 |
gr.Interface(fn=predict, inputs=[gr.components.Dropdown(["low", "mid", "high"], label="Protection Level"),
|
| 13 |
gr.components.Image(type='filepath')],
|
| 14 |
-
outputs=gr.components.Image(type="pil")).launch(show_error=True)
|
|
|
|
| 1 |
from fawkes.protection import Fawkes
|
| 2 |
import gradio as gr
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
def predict(level, img):
|
| 6 |
# print(img)
|
| 7 |
fwks = Fawkes("extractor_2", '0', 1, mode=level)
|
| 8 |
fwks.run_protection([img], format='jpeg')
|
| 9 |
splt = img.split(".")
|
| 10 |
+
print(os.listdir('/tmp'))
|
| 11 |
+
return splt[0] + "_cloaked.jpeg"
|
| 12 |
|
| 13 |
gr.Interface(fn=predict, inputs=[gr.components.Dropdown(["low", "mid", "high"], label="Protection Level"),
|
| 14 |
gr.components.Image(type='filepath')],
|
| 15 |
+
outputs=gr.components.Image(type="pil")).launch(show_error=True, server_name="0.0.0.0")
|