Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -796,6 +796,7 @@ def create_interface():
|
|
| 796 |
5. **โ๏ธ Adjust confidence threshold**
|
| 797 |
6. **๐ Click "Analyse Text"** to see results
|
| 798 |
(NB: common/custom entities which overlap are shown with split-colour highlighting)
|
|
|
|
| 799 |
""")
|
| 800 |
# Add tip box
|
| 801 |
gr.HTML("""
|
|
@@ -826,7 +827,7 @@ def create_interface():
|
|
| 826 |
gr.HTML("""
|
| 827 |
<details style="margin: 10px 0; padding: 10px; background-color: #f0f9ff; border-radius: 8px; border: 1px solid #bee3f8;">
|
| 828 |
<summary style="cursor: pointer; font-weight: bold; padding: 5px; color: #2563eb;">
|
| 829 |
-
โน๏ธ
|
| 830 |
</summary>
|
| 831 |
<div style="margin-top: 10px; padding: 10px; font-size: 14px;">
|
| 832 |
<p style="margin: 0 0 10px 0;">The <strong>confidence threshold</strong> controls how certain the model needs to be before identifying an entity:</p>
|
|
@@ -835,7 +836,7 @@ def create_interface():
|
|
| 835 |
<li><strong>Medium values (0.4-0.6):</strong> Balanced detection with moderate confidence</li>
|
| 836 |
<li><strong>Higher values (0.7-0.9):</strong> Only highly confident entities detected, may miss some valid entities</li>
|
| 837 |
</ul>
|
| 838 |
-
<p style="margin: 10px 0 0 0; font-style: italic;">Start with 0.3 for comprehensive detection, then adjust based on your needs.</p>
|
| 839 |
</div>
|
| 840 |
</details>
|
| 841 |
""")
|
|
@@ -985,9 +986,9 @@ def create_interface():
|
|
| 985 |
|
| 986 |
# Updated examples text
|
| 987 |
gr.Markdown("""
|
| 988 |
-
### No example text to test? No problem!
|
| 989 |
Simply click on one of the examples provided below, and the fields will be populated for you.
|
| 990 |
-
""")
|
| 991 |
|
| 992 |
gr.Examples(
|
| 993 |
examples=[
|
|
@@ -1019,9 +1020,29 @@ def create_interface():
|
|
| 1019 |
custom_entities,
|
| 1020 |
confidence_threshold,
|
| 1021 |
model_dropdown
|
| 1022 |
-
]
|
|
|
|
| 1023 |
)
|
| 1024 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1025 |
# Add model information links
|
| 1026 |
gr.HTML("""
|
| 1027 |
<hr style="margin-top: 40px; margin-bottom: 20px;">
|
|
@@ -1063,8 +1084,8 @@ def create_interface():
|
|
| 1063 |
funded research project:<br>
|
| 1064 |
<em>Extracting Keywords from Crowdsourced Collections</em>.
|
| 1065 |
</p>
|
| 1066 |
-
<p style="font-size: 14px; line-height: 1.8; margin: 0;">
|
| 1067 |
-
The code for this tool was built with the aid of Claude Opus 4
|
| 1068 |
</p>
|
| 1069 |
</div>
|
| 1070 |
""")
|
|
|
|
| 796 |
5. **โ๏ธ Adjust confidence threshold**
|
| 797 |
6. **๐ Click "Analyse Text"** to see results
|
| 798 |
(NB: common/custom entities which overlap are shown with split-colour highlighting)
|
| 799 |
+
7. **๐ Refresh the page** to try again with new text
|
| 800 |
""")
|
| 801 |
# Add tip box
|
| 802 |
gr.HTML("""
|
|
|
|
| 827 |
gr.HTML("""
|
| 828 |
<details style="margin: 10px 0; padding: 10px; background-color: #f0f9ff; border-radius: 8px; border: 1px solid #bee3f8;">
|
| 829 |
<summary style="cursor: pointer; font-weight: bold; padding: 5px; color: #2563eb;">
|
| 830 |
+
โน๏ธ Understanding Confidence Threshold
|
| 831 |
</summary>
|
| 832 |
<div style="margin-top: 10px; padding: 10px; font-size: 14px;">
|
| 833 |
<p style="margin: 0 0 10px 0;">The <strong>confidence threshold</strong> controls how certain the model needs to be before identifying an entity:</p>
|
|
|
|
| 836 |
<li><strong>Medium values (0.4-0.6):</strong> Balanced detection with moderate confidence</li>
|
| 837 |
<li><strong>Higher values (0.7-0.9):</strong> Only highly confident entities detected, may miss some valid entities</li>
|
| 838 |
</ul>
|
| 839 |
+
<p style="margin: 10px 0 0 0; font-style: italic;"><strong>Top Tip:</strong> Start with 0.3 for comprehensive detection, then adjust based on your needs.</p>
|
| 840 |
</div>
|
| 841 |
</details>
|
| 842 |
""")
|
|
|
|
| 986 |
|
| 987 |
# Updated examples text
|
| 988 |
gr.Markdown("""
|
| 989 |
+
### ๐ก No example text to test? No problem!
|
| 990 |
Simply click on one of the examples provided below, and the fields will be populated for you.
|
| 991 |
+
""", elem_id="examples-heading")
|
| 992 |
|
| 993 |
gr.Examples(
|
| 994 |
examples=[
|
|
|
|
| 1020 |
custom_entities,
|
| 1021 |
confidence_threshold,
|
| 1022 |
model_dropdown
|
| 1023 |
+
],
|
| 1024 |
+
label="Examples"
|
| 1025 |
)
|
| 1026 |
|
| 1027 |
+
# Add custom CSS to make Examples label black
|
| 1028 |
+
gr.HTML("""
|
| 1029 |
+
<style>
|
| 1030 |
+
/* Make the Examples label text black */
|
| 1031 |
+
.gradio-examples-label {
|
| 1032 |
+
color: black !important;
|
| 1033 |
+
}
|
| 1034 |
+
/* Also target the label more specifically if needed */
|
| 1035 |
+
h4.examples-label, .examples-label {
|
| 1036 |
+
color: black !important;
|
| 1037 |
+
}
|
| 1038 |
+
/* Override any link colors in the examples section */
|
| 1039 |
+
#examples-heading + div label,
|
| 1040 |
+
#examples-heading + div .label-text {
|
| 1041 |
+
color: black !important;
|
| 1042 |
+
}
|
| 1043 |
+
</style>
|
| 1044 |
+
""")
|
| 1045 |
+
|
| 1046 |
# Add model information links
|
| 1047 |
gr.HTML("""
|
| 1048 |
<hr style="margin-top: 40px; margin-bottom: 20px;">
|
|
|
|
| 1084 |
funded research project:<br>
|
| 1085 |
<em>Extracting Keywords from Crowdsourced Collections</em>.
|
| 1086 |
</p>
|
| 1087 |
+
<p style="font-size: 14px; line-height: 1.8; margin: 0;"><p>
|
| 1088 |
+
The code for this tool was built with the aid of Claude Opus 4.</p>
|
| 1089 |
</p>
|
| 1090 |
</div>
|
| 1091 |
""")
|