elismasilva commited on
Commit
3f40635
·
verified ·
1 Parent(s): b83d9ce

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +1 -31
  2. src/demo/app.py +1 -31
app.py CHANGED
@@ -27,26 +27,6 @@ class PropertyConfig:
27
  image_settings: ImageSettings = field(default_factory=ImageSettings)
28
  description: str = field(default="", metadata={"label": "Description"})
29
 
30
- def process_example_images(img_custom_path: str, img_all_path: str) -> tuple[str, str]:
31
- """
32
- Processes example image paths for display in ImageMeta components.
33
-
34
- Args:
35
- img_custom_path: File path for the image to display in img_custom.
36
- img_all_path: File path for the image to display in img_all.
37
-
38
- Returns:
39
- Tuple of file paths for img_custom and img_all outputs.
40
- """
41
- # Verify file existence
42
- if not Path(img_custom_path.path).is_file():
43
- raise FileNotFoundError(f"Image not found: {img_custom_path}")
44
- if not Path(img_all_path.path).is_file():
45
- raise FileNotFoundError(f"Image not found: {img_all_path}")
46
-
47
- # Return file paths as strings (ImageMeta accepts file paths as input)
48
- return img_custom_path.path, img_all_path.path
49
-
50
  def handle_load_metadata(image_data: ImageMeta | None) -> List[Any]:
51
  """
52
  Processes image metadata and maps it to output components.
@@ -154,17 +134,7 @@ with gr.Blocks() as demo:
154
  with gr.Row():
155
  save_button = gr.Button("Add Metadata and Save Image")
156
  saved_file_output = gr.File(label="Download Image")
157
-
158
- with gr.Row():
159
- gr.Examples(
160
- examples=[
161
- ["./src/examples/image_with_meta.png", "./src/examples/image_with_meta.png"]
162
- ],
163
- fn=process_example_images,
164
- inputs=[img_custom, img_all],
165
- outputs=[img_custom, img_all],
166
- cache_examples=True
167
- )
168
 
169
  input_fields = {
170
  "Model": model_box,
 
27
  image_settings: ImageSettings = field(default_factory=ImageSettings)
28
  description: str = field(default="", metadata={"label": "Description"})
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  def handle_load_metadata(image_data: ImageMeta | None) -> List[Any]:
31
  """
32
  Processes image metadata and maps it to output components.
 
134
  with gr.Row():
135
  save_button = gr.Button("Add Metadata and Save Image")
136
  saved_file_output = gr.File(label="Download Image")
137
+
 
 
 
 
 
 
 
 
 
 
138
 
139
  input_fields = {
140
  "Model": model_box,
src/demo/app.py CHANGED
@@ -27,26 +27,6 @@ class PropertyConfig:
27
  image_settings: ImageSettings = field(default_factory=ImageSettings)
28
  description: str = field(default="", metadata={"label": "Description"})
29
 
30
- def process_example_images(img_custom_path: str, img_all_path: str) -> tuple[str, str]:
31
- """
32
- Processes example image paths for display in ImageMeta components.
33
-
34
- Args:
35
- img_custom_path: File path for the image to display in img_custom.
36
- img_all_path: File path for the image to display in img_all.
37
-
38
- Returns:
39
- Tuple of file paths for img_custom and img_all outputs.
40
- """
41
- # Verify file existence
42
- if not Path(img_custom_path.path).is_file():
43
- raise FileNotFoundError(f"Image not found: {img_custom_path}")
44
- if not Path(img_all_path.path).is_file():
45
- raise FileNotFoundError(f"Image not found: {img_all_path}")
46
-
47
- # Return file paths as strings (ImageMeta accepts file paths as input)
48
- return img_custom_path.path, img_all_path.path
49
-
50
  def handle_load_metadata(image_data: ImageMeta | None) -> List[Any]:
51
  """
52
  Processes image metadata and maps it to output components.
@@ -154,17 +134,7 @@ with gr.Blocks() as demo:
154
  with gr.Row():
155
  save_button = gr.Button("Add Metadata and Save Image")
156
  saved_file_output = gr.File(label="Download Image")
157
-
158
- with gr.Row():
159
- gr.Examples(
160
- examples=[
161
- ["./src/examples/image_with_meta.png", "./src/examples/image_with_meta.png"]
162
- ],
163
- fn=process_example_images,
164
- inputs=[img_custom, img_all],
165
- outputs=[img_custom, img_all],
166
- cache_examples=True
167
- )
168
 
169
  input_fields = {
170
  "Model": model_box,
 
27
  image_settings: ImageSettings = field(default_factory=ImageSettings)
28
  description: str = field(default="", metadata={"label": "Description"})
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  def handle_load_metadata(image_data: ImageMeta | None) -> List[Any]:
31
  """
32
  Processes image metadata and maps it to output components.
 
134
  with gr.Row():
135
  save_button = gr.Button("Add Metadata and Save Image")
136
  saved_file_output = gr.File(label="Download Image")
137
+
 
 
 
 
 
 
 
 
 
 
138
 
139
  input_fields = {
140
  "Model": model_box,