Spaces:
Paused
Paused
Suprhimp
commited on
Commit
•
4bf280a
1
Parent(s):
3938fda
virtual display
Browse files- Dockerfile +1 -0
- opengl.py +26 -21
- requirements.txt +2 -1
Dockerfile
CHANGED
@@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y libgl1-mesa-glx libosmesa6
|
|
9 |
RUN apt-get install -y python3-opengl
|
10 |
RUN apt-get install -y libosmesa6-dev
|
11 |
RUN apt-get install -y freeglut3-dev
|
|
|
12 |
# RUN apt update && apt install -y python3 python3-pip git xvfb xorg-dev cmake
|
13 |
RUN apt-get upgrade -y && apt-get install -y python3-pip python-is-python3 && rm -rf /var/lib/apt/lists/*
|
14 |
RUN pip install -r requirements.txt
|
|
|
9 |
RUN apt-get install -y python3-opengl
|
10 |
RUN apt-get install -y libosmesa6-dev
|
11 |
RUN apt-get install -y freeglut3-dev
|
12 |
+
RUN apt-get install xvfb xserver-xephyr tigervnc-standalone-server x11-utils gnumeric
|
13 |
# RUN apt update && apt install -y python3 python3-pip git xvfb xorg-dev cmake
|
14 |
RUN apt-get upgrade -y && apt-get install -y python3-pip python-is-python3 && rm -rf /var/lib/apt/lists/*
|
15 |
RUN pip install -r requirements.txt
|
opengl.py
CHANGED
@@ -16,8 +16,8 @@ import OpenGL
|
|
16 |
import ctypes
|
17 |
import ctypes.util
|
18 |
# from lucid.misc.gl.glcontext import create_opengl_context
|
19 |
-
from lib.glcontext import create_opengl_context
|
20 |
-
|
21 |
from OpenGL.GL import *
|
22 |
import OpenGL.GL.shaders
|
23 |
import numpy
|
@@ -25,30 +25,35 @@ from PIL import Image
|
|
25 |
import base64
|
26 |
from io import BytesIO
|
27 |
from utils.settings import set_options
|
|
|
28 |
|
29 |
|
30 |
def image_enhance(image, exposure, saturation, contrast, brightness, gamma, shadows, highlights, whites, blacks,
|
31 |
clarity, temperature, sharpness):
|
32 |
-
create_opengl_context()
|
33 |
# Initialize glfw
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
#
|
42 |
-
#
|
43 |
-
|
44 |
-
|
45 |
-
#
|
46 |
-
|
47 |
-
#
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
|
53 |
#
|
54 |
|
|
|
16 |
import ctypes
|
17 |
import ctypes.util
|
18 |
# from lucid.misc.gl.glcontext import create_opengl_context
|
19 |
+
# from lib.glcontext import create_opengl_context
|
20 |
+
import glfw
|
21 |
from OpenGL.GL import *
|
22 |
import OpenGL.GL.shaders
|
23 |
import numpy
|
|
|
25 |
import base64
|
26 |
from io import BytesIO
|
27 |
from utils.settings import set_options
|
28 |
+
from pyvirtualdisplay import Display
|
29 |
|
30 |
|
31 |
def image_enhance(image, exposure, saturation, contrast, brightness, gamma, shadows, highlights, whites, blacks,
|
32 |
clarity, temperature, sharpness):
|
33 |
+
# create_opengl_context((image.width,image.height))
|
34 |
# Initialize glfw
|
35 |
+
disp = Display()
|
36 |
+
disp.start()
|
37 |
+
|
38 |
+
if not glfw.init():
|
39 |
+
print('error in init')
|
40 |
+
return
|
41 |
+
|
42 |
+
# Create window
|
43 |
+
# Size (1, 1) for show nothing in window
|
44 |
+
glfw.window_hint(glfw.VISIBLE, False)
|
45 |
+
window = glfw.create_window(1, 1, "My OpenGL window", None, None)
|
46 |
+
# window = glfw.create_window(800, 600, "My OpenGL window", None, None)
|
47 |
+
|
48 |
+
# Terminate if any issue
|
49 |
+
if not window:
|
50 |
+
print('error in window')
|
51 |
+
glfw.terminate()
|
52 |
+
return
|
53 |
+
|
54 |
+
# Set context to window
|
55 |
+
glfw.make_context_current(window)
|
56 |
+
disp.stop()
|
57 |
|
58 |
#
|
59 |
|
requirements.txt
CHANGED
@@ -5,4 +5,5 @@ uvicorn
|
|
5 |
pydantic
|
6 |
glfw
|
7 |
PyOpenGL==3.1.5
|
8 |
-
boto3
|
|
|
|
5 |
pydantic
|
6 |
glfw
|
7 |
PyOpenGL==3.1.5
|
8 |
+
boto3
|
9 |
+
pyvirtualdisplay
|