Skip to content
Snippets Groups Projects
Commit 140bce35 authored by Nolan's avatar Nolan Committed by Yoann Schneider
Browse files

Remove HTML from Markdown

parent 8dbe3448
No related branches found
No related tags found
1 merge request!85Remove HTML from Markdown
Pipeline #72228 passed
...@@ -313,8 +313,8 @@ An example is available in the `huggingface/` folder. You need to create a JSON ...@@ -313,8 +313,8 @@ An example is available in the `huggingface/` folder. You need to create a JSON
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- | | ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
| `model_name` | Name of the model |`doc-ufcn-generic-historical-line`| | `model_name` | Name of the model |`doc-ufcn-generic-historical-line`|
| `classes_colors` | List with the colors of the classes | `["green"]`| | `classes_colors` | List with the colors of the classes | `["green"]`|
| `title` | Title of the app | **Required**| | `title` | Title of the app (supports Markdown) | **Required**|
| `description` | Description of the app | **Required**| | `description` | Description of the app (supports Markdown) | **Required**|
| `examples` | Paths towards the image examples. | **Required**| | `examples` | Paths towards the image examples. | **Required**|
A ready-to-use configuration file is available in `huggingface/config.json`. You may update it to your needs. A ready-to-use configuration file is available in `huggingface/config.json`. You may update it to your needs.
......
...@@ -101,15 +101,13 @@ def query_image(image): ...@@ -101,15 +101,13 @@ def query_image(image):
# Add an index to dictionary keys to differentiate predictions of the same class # Add an index to dictionary keys to differentiate predictions of the same class
predict.append( predict.append(
{ {
"polygon": np.asarray(polygon["polygon"]) # The list of coordinates of the points of the polygon.
.astype(int) # Cast to list of np.int32 to make it JSON-serializable
.tolist(), # The list of coordinates of the points of the polygon "polygon": np.asarray(polygon["polygon"], dtype=np.int32).tolist(),
"confidence": polygon[ # Confidence that the model predicts the polygon in the right place
"confidence" "confidence": polygon["confidence"],
], # Confidence that the model predicts the polygon in the right place # The channel on which the polygon is predicted
"channel": classes[ "channel": classes[channel],
channel
], # The channel on which the polygon is predicted
} }
) )
...@@ -120,7 +118,7 @@ def query_image(image): ...@@ -120,7 +118,7 @@ def query_image(image):
with gr.Blocks() as process_image: with gr.Blocks() as process_image:
# Create app title # Create app title
gr.Markdown(f"<h1 align='center'>{config['title']}</h1>") gr.Markdown(f"# {config['title']}")
# Create app description # Create app description
gr.Markdown(config["description"]) gr.Markdown(config["description"])
...@@ -167,10 +165,10 @@ with gr.Blocks() as process_image: ...@@ -167,10 +165,10 @@ with gr.Blocks() as process_image:
# Generates a json with the model predictions # Generates a json with the model predictions
json_output = gr.JSON() json_output = gr.JSON()
# Create the button to clear the inputs and outputs # Clear button: set default values to inputs and output objects
clear_button.click( clear_button.click(
lambda x, y, z: (None, None, None), lambda: (None, None, None),
inputs=[image, image_output, json_output], inputs=[],
outputs=[image, image_output, json_output], outputs=[image, image_output, json_output],
) )
......
hugging_face/resource/hf_doc_ufcn_line_hist.png

1.09 MiB | W: | H:

hugging_face/resource/hf_doc_ufcn_line_hist.png

1.09 MiB | W: | H:

hugging_face/resource/hf_doc_ufcn_line_hist.png
hugging_face/resource/hf_doc_ufcn_line_hist.png
hugging_face/resource/hf_doc_ufcn_line_hist.png
hugging_face/resource/hf_doc_ufcn_line_hist.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment