lalamax3d commited on
Commit
1c8cd5f
·
1 Parent(s): efc1996

Fix gradio compatibility issues

Browse files
Files changed (4) hide show
  1. .github/workflows/deploy.yml +0 -0
  2. .huggingface.yaml +2 -2
  3. app.py +10 -5
  4. 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: 5.0.0
3
 
4
  build:
5
  gpu: false
6
- python_version: "3.11"
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
- interface = gr.Interface(
67
  fn=visualize_palette,
68
- inputs=[gr.Image(type="numpy"), gr.Slider(2, 10, step=1, value=5, label="Number of Colors")],
69
- outputs="image",
 
 
 
70
  title="Color Palette Extractor",
71
- description="Upload an image and extract a fixed number of dominant colors."
 
72
  )
73
 
74
  # Launch the app
75
- interface.launch()
 
 
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>=4.19.2
2
- numpy>=1.24.0
3
- opencv-python-headless>=4.8.0
4
- scikit-learn>=1.3.0
 
1
+ gradio==4.19.2
2
+ numpy==1.24.3
3
+ opencv-python-headless==4.8.0.76
4
+ scikit-learn==1.3.0