Fix gradio compatibility issues
Browse files- .github/workflows/deploy.yml +0 -0
- .huggingface.yaml +2 -2
- app.py +10 -5
- requirements.txt +4 -4
.github/workflows/deploy.yml
ADDED
|
File without changes
|
.huggingface.yaml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
sdk: gradio
|
| 2 |
-
sdk_version:
|
| 3 |
|
| 4 |
build:
|
| 5 |
gpu: false
|
| 6 |
-
python_version: "3.
|
| 7 |
|
| 8 |
runtime:
|
| 9 |
model:
|
|
|
|
| 1 |
sdk: gradio
|
| 2 |
+
sdk_version: 4.19.2
|
| 3 |
|
| 4 |
build:
|
| 5 |
gpu: false
|
| 6 |
+
python_version: "3.10"
|
| 7 |
|
| 8 |
runtime:
|
| 9 |
model:
|
app.py
CHANGED
|
@@ -63,13 +63,18 @@ def visualize_palette(image, num_colors):
|
|
| 63 |
return output_path
|
| 64 |
|
| 65 |
# Gradio Interface
|
| 66 |
-
|
| 67 |
fn=visualize_palette,
|
| 68 |
-
inputs=[
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
| 70 |
title="Color Palette Extractor",
|
| 71 |
-
description="Upload an image and extract
|
|
|
|
| 72 |
)
|
| 73 |
|
| 74 |
# Launch the app
|
| 75 |
-
|
|
|
|
|
|
| 63 |
return output_path
|
| 64 |
|
| 65 |
# Gradio Interface
|
| 66 |
+
demo = gr.Interface(
|
| 67 |
fn=visualize_palette,
|
| 68 |
+
inputs=[
|
| 69 |
+
gr.Image(type="numpy", label="Input Image"),
|
| 70 |
+
gr.Slider(minimum=2, maximum=50, step=1, value=5, label="Number of Colors")
|
| 71 |
+
],
|
| 72 |
+
outputs=gr.Image(type="filepath", label="Color Palette"),
|
| 73 |
title="Color Palette Extractor",
|
| 74 |
+
description="Upload an image and extract its dominant colors. The colors are sorted by their frequency in the image.",
|
| 75 |
+
allow_flagging="never"
|
| 76 |
)
|
| 77 |
|
| 78 |
# Launch the app
|
| 79 |
+
if __name__ == "__main__":
|
| 80 |
+
demo.launch()
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio
|
| 2 |
-
numpy
|
| 3 |
-
opencv-python-headless
|
| 4 |
-
scikit-learn
|
|
|
|
| 1 |
+
gradio==4.19.2
|
| 2 |
+
numpy==1.24.3
|
| 3 |
+
opencv-python-headless==4.8.0.76
|
| 4 |
+
scikit-learn==1.3.0
|