Spaces:
Sleeping
Sleeping
fix color preview
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
import cv2
|
3 |
import numpy as np
|
4 |
from PIL import Image, ImageDraw
|
5 |
|
@@ -21,14 +20,13 @@ def get_rgb_and_plot_point(img, x, y, point_size):
|
|
21 |
|
22 |
# Gradio interface function
|
23 |
def image_rgb_extractor(img, x, y, point_size):
|
24 |
-
img = cv2.cvtColor(np.array(img), cv2.COLOR_BGR2RGB) # Convert to RGB format
|
25 |
return get_rgb_and_plot_point(img, int(x), int(y), int(point_size))
|
26 |
|
27 |
# Set up the Gradio interface
|
28 |
input_image = gr.Image(type="pil", label="Upload an Image")
|
29 |
input_x = gr.Number(label="X-coordinate")
|
30 |
input_y = gr.Number(label="Y-coordinate")
|
31 |
-
input_point_size = gr.Number(label="Point Size", value=10)
|
32 |
output_rgb = gr.Textbox(label="RGB Value at Point")
|
33 |
output_image = gr.Image(label="Image with Point")
|
34 |
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import numpy as np
|
3 |
from PIL import Image, ImageDraw
|
4 |
|
|
|
20 |
|
21 |
# Gradio interface function
|
22 |
def image_rgb_extractor(img, x, y, point_size):
|
|
|
23 |
return get_rgb_and_plot_point(img, int(x), int(y), int(point_size))
|
24 |
|
25 |
# Set up the Gradio interface
|
26 |
input_image = gr.Image(type="pil", label="Upload an Image")
|
27 |
input_x = gr.Number(label="X-coordinate")
|
28 |
input_y = gr.Number(label="Y-coordinate")
|
29 |
+
input_point_size = gr.Number(label="Point Size", value=10)
|
30 |
output_rgb = gr.Textbox(label="RGB Value at Point")
|
31 |
output_image = gr.Image(label="Image with Point")
|
32 |
|