Spaces:
Running
Running
kovacsvi
commited on
Commit
·
3e91901
1
Parent(s):
3424c6f
interpretation info
Browse files
interfaces/cap_minor_media.py
CHANGED
@@ -126,7 +126,20 @@ def predict(text, major_model_id, minor_model_id, tokenizer_id, HF_TOKEN=None):
|
|
126 |
|
127 |
output_info = f'<p style="text-align: center; display: block">Prediction used <a href="https://huggingface.co/{major_model_id}">{major_model_id}</a> and <a href="https://huggingface.co/{minor_model_id}">{minor_model_id}</a>.</p>'
|
128 |
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
def predict_cap(tmp, method, text, language, domain):
|
132 |
domain = domains[domain]
|
@@ -161,4 +174,4 @@ demo = gr.Interface(
|
|
161 |
gr.Textbox(lines=6, label="Input"),
|
162 |
gr.Dropdown(languages, label="Language"),
|
163 |
gr.Dropdown(domains.keys(), label="Domain")],
|
164 |
-
outputs=[gr.Label(label="Output"), gr.Markdown()])
|
|
|
126 |
|
127 |
output_info = f'<p style="text-align: center; display: block">Prediction used <a href="https://huggingface.co/{major_model_id}">{major_model_id}</a> and <a href="https://huggingface.co/{minor_model_id}">{minor_model_id}</a>.</p>'
|
128 |
|
129 |
+
interpretation_info = """
|
130 |
+
## How to Interpret These Values (Hierarchical Classification)
|
131 |
+
|
132 |
+
This method returns either:
|
133 |
+
|
134 |
+
- A list of **major (media) topic confidences**, or
|
135 |
+
- A list of **minor topic confidences**.
|
136 |
+
|
137 |
+
In the case of minor topics, the values are the confidences for minor topics **within a given major topic**, and they are **normalized to sum to 1**.
|
138 |
+
|
139 |
+
**Note:** This method cannot return a mix of major and minor topic predictions.
|
140 |
+
"""
|
141 |
+
|
142 |
+
return interpretation_info, output_pred, output_info
|
143 |
|
144 |
def predict_cap(tmp, method, text, language, domain):
|
145 |
domain = domains[domain]
|
|
|
174 |
gr.Textbox(lines=6, label="Input"),
|
175 |
gr.Dropdown(languages, label="Language"),
|
176 |
gr.Dropdown(domains.keys(), label="Domain")],
|
177 |
+
outputs=[gr.Markdown(), gr.Label(label="Output"), gr.Markdown()])
|