Spaces:
Paused
Paused
Suprhimp
commited on
Commit
·
23963be
1
Parent(s):
8bef74b
test update
Browse files- Dockerfile +1 -1
- opengl.py +22 -17
- requirements.txt +2 -1
Dockerfile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
FROM nvidia/cuda:11.7.1-base-ubuntu22.04
|
| 2 |
-
ENV DISPLAY :
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
| 1 |
FROM nvidia/cuda:11.7.1-base-ubuntu22.04
|
| 2 |
+
ENV DISPLAY :99.0
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
COPY ./requirements.txt /code/requirements.txt
|
opengl.py
CHANGED
|
@@ -11,7 +11,11 @@
|
|
| 11 |
"""
|
| 12 |
|
| 13 |
|
| 14 |
-
import glfw
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
from OpenGL.GL import *
|
| 16 |
import OpenGL.GL.shaders
|
| 17 |
import numpy
|
|
@@ -23,25 +27,26 @@ from utils.settings import set_options
|
|
| 23 |
|
| 24 |
def image_enhance(image, exposure, saturation, contrast, brightness, gamma, shadows, highlights, whites, blacks,
|
| 25 |
clarity, temperature, sharpness):
|
|
|
|
| 26 |
# Initialize glfw
|
| 27 |
-
if not glfw.init():
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
-
# Create window
|
| 32 |
-
# Size (1, 1) for show nothing in window
|
| 33 |
-
glfw.window_hint(glfw.VISIBLE, False)
|
| 34 |
-
window = glfw.create_window(1, 1, "My OpenGL window", None, None)
|
| 35 |
-
# window = glfw.create_window(800, 600, "My OpenGL window", None, None)
|
| 36 |
|
| 37 |
-
# Terminate if any issue
|
| 38 |
-
if not window:
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
# Set context to window
|
| 44 |
-
glfw.make_context_current(window)
|
| 45 |
|
| 46 |
#
|
| 47 |
|
|
@@ -395,7 +400,7 @@ def image_enhance(image, exposure, saturation, contrast, brightness, gamma, shad
|
|
| 395 |
0, 0, image.width, image.height, GL_RGBA, GL_UNSIGNED_BYTE)
|
| 396 |
image_out = numpy.frombuffer(image_buffer, dtype=numpy.uint8)
|
| 397 |
image_out = image_out.reshape(image.height, image.width, 4)
|
| 398 |
-
glfw.terminate()
|
| 399 |
img = Image.fromarray(image_out, 'RGB')
|
| 400 |
|
| 401 |
|
|
|
|
| 11 |
"""
|
| 12 |
|
| 13 |
|
| 14 |
+
# import glfw
|
| 15 |
+
import OpenGL
|
| 16 |
+
OpenGL.ERROR_CHECKING = True
|
| 17 |
+
from lucid.misc.gl.glcontext import create_opengl_context
|
| 18 |
+
|
| 19 |
from OpenGL.GL import *
|
| 20 |
import OpenGL.GL.shaders
|
| 21 |
import numpy
|
|
|
|
| 27 |
|
| 28 |
def image_enhance(image, exposure, saturation, contrast, brightness, gamma, shadows, highlights, whites, blacks,
|
| 29 |
clarity, temperature, sharpness):
|
| 30 |
+
create_opengl_context((image.width, image.height))
|
| 31 |
# Initialize glfw
|
| 32 |
+
# if not glfw.init():
|
| 33 |
+
# print('error in init')
|
| 34 |
+
# return
|
| 35 |
|
| 36 |
+
# # Create window
|
| 37 |
+
# # Size (1, 1) for show nothing in window
|
| 38 |
+
# glfw.window_hint(glfw.VISIBLE, False)
|
| 39 |
+
# window = glfw.create_window(1, 1, "My OpenGL window", None, None)
|
| 40 |
+
# # window = glfw.create_window(800, 600, "My OpenGL window", None, None)
|
| 41 |
|
| 42 |
+
# # Terminate if any issue
|
| 43 |
+
# if not window:
|
| 44 |
+
# print('error in window')
|
| 45 |
+
# glfw.terminate()
|
| 46 |
+
# return
|
| 47 |
|
| 48 |
+
# # Set context to window
|
| 49 |
+
# glfw.make_context_current(window)
|
| 50 |
|
| 51 |
#
|
| 52 |
|
|
|
|
| 400 |
0, 0, image.width, image.height, GL_RGBA, GL_UNSIGNED_BYTE)
|
| 401 |
image_out = numpy.frombuffer(image_buffer, dtype=numpy.uint8)
|
| 402 |
image_out = image_out.reshape(image.height, image.width, 4)
|
| 403 |
+
# glfw.terminate()
|
| 404 |
img = Image.fromarray(image_out, 'RGB')
|
| 405 |
|
| 406 |
|
requirements.txt
CHANGED
|
@@ -5,4 +5,5 @@ uvicorn
|
|
| 5 |
pydantic
|
| 6 |
glfw
|
| 7 |
PyOpenGL==3.1.1a1
|
| 8 |
-
boto3
|
|
|
|
|
|
| 5 |
pydantic
|
| 6 |
glfw
|
| 7 |
PyOpenGL==3.1.1a1
|
| 8 |
+
boto3
|
| 9 |
+
lucid
|