Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -172,6 +172,40 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 172 |
|
| 173 |
T_data_ss_state = gr.State(value=pd.DataFrame())
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
with gr.Tab("Event Type Classification"):
|
| 176 |
gr.Markdown(
|
| 177 |
"""
|
|
@@ -244,36 +278,6 @@ with gr.Blocks(fill_width=True) as demo:
|
|
| 244 |
hsummary = gr.Textbox(label="Summary")
|
| 245 |
|
| 246 |
qa_df = gr.DataFrame(visible=False)
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
with gr.Tab("Single Text Classification"):
|
| 250 |
-
gr.Markdown(
|
| 251 |
-
"""
|
| 252 |
-
# Event Type Prediction Demo
|
| 253 |
-
In this section you test the relevance classifier with written texts.\n
|
| 254 |
-
Usage:\n
|
| 255 |
-
- Type a tweet-like text in the textbox.\n
|
| 256 |
-
- Then press Enter.\n
|
| 257 |
-
""")
|
| 258 |
-
with gr.Row():
|
| 259 |
-
with gr.Column(scale=3):
|
| 260 |
-
model_sing_classify = gr.Dropdown(event_models, value=event_models[0], label="Select classification model")
|
| 261 |
-
with gr.Column(scale=7):
|
| 262 |
-
threshold_sing_classify = gr.Slider(0, 1, value=0, step=0.01, label="Prediction threshold",
|
| 263 |
-
info="This value sets a threshold by which texts classified flood or fire are accepted, \
|
| 264 |
-
higher values makes the classifier stricter (CAUTION: A value of 1 will set all predictions as none)", interactive=True)
|
| 265 |
-
|
| 266 |
-
text_to_classify = gr.Textbox(label="Text", info="Enter tweet-like text", submit_btn=True)
|
| 267 |
-
text_to_classify_examples = gr.Examples([["The streets are flooded, I can't leave #BostonStorm"],
|
| 268 |
-
["Controlado el incendio de Rodezno que ha obligado a desalojar a varias bodegas de la zona."],
|
| 269 |
-
["Cambrils:estaci贸 Renfe inundada 19 persones dins d'un tren. FGC a Capellades, petit descarrilament 5 passatgers #Inuncat @emergenciescat"],
|
| 270 |
-
["Anscheinend steht die komplette Neckarwiese unter Wasser! #Hochwasser"]], text_to_classify)
|
| 271 |
-
|
| 272 |
-
with gr.Row():
|
| 273 |
-
with gr.Column():
|
| 274 |
-
classification = gr.Textbox(label="Classification")
|
| 275 |
-
with gr.Column():
|
| 276 |
-
classification_score = gr.Number(label="Classification Score")
|
| 277 |
|
| 278 |
|
| 279 |
# with gr.Tab("Event Type Classification Eval"):
|
|
|
|
| 172 |
|
| 173 |
T_data_ss_state = gr.State(value=pd.DataFrame())
|
| 174 |
|
| 175 |
+
|
| 176 |
+
with gr.Tab("Single Text Classification"):
|
| 177 |
+
gr.Markdown(
|
| 178 |
+
"""
|
| 179 |
+
# Event Type Prediction Demo
|
| 180 |
+
In this section you test the relevance classifier with written texts.\n
|
| 181 |
+
Usage:\n
|
| 182 |
+
- Type a tweet-like text in the textbox.\n
|
| 183 |
+
- Then press Enter.\n
|
| 184 |
+
""")
|
| 185 |
+
with gr.Group():
|
| 186 |
+
with gr.Row():
|
| 187 |
+
with gr.Column(scale=3):
|
| 188 |
+
model_sing_classify = gr.Dropdown(event_models, value=event_models[0], label="Select classification model")
|
| 189 |
+
with gr.Column(scale=7):
|
| 190 |
+
with gr.Accordion("Prediction threshold", open=False):
|
| 191 |
+
T_threshold = gr.Slider(0, 1, value=0, step=0.01, label="Prediction threshold", show_label=False,
|
| 192 |
+
info="This value sets a threshold by which texts classified flood or fire are accepted, \
|
| 193 |
+
higher values makes the classifier stricter (CAUTION: A value of 1 will set all predictions as none)", interactive=True)
|
| 194 |
+
|
| 195 |
+
text_to_classify = gr.Textbox(label="Text", info="Enter tweet-like text", submit_btn=True)
|
| 196 |
+
text_to_classify_examples = gr.Examples([["The streets are flooded, I can't leave #BostonStorm"],
|
| 197 |
+
["Controlado el incendio de Rodezno que ha obligado a desalojar a varias bodegas de la zona."],
|
| 198 |
+
["Cambrils:estaci贸 Renfe inundada 19 persones dins d'un tren. FGC a Capellades, petit descarrilament 5 passatgers #Inuncat @emergenciescat"],
|
| 199 |
+
["Anscheinend steht die komplette Neckarwiese unter Wasser! #Hochwasser"]], text_to_classify)
|
| 200 |
+
|
| 201 |
+
with gr.Group():
|
| 202 |
+
with gr.Row():
|
| 203 |
+
with gr.Column():
|
| 204 |
+
classification = gr.Textbox(label="Classification")
|
| 205 |
+
with gr.Column():
|
| 206 |
+
classification_score = gr.Number(label="Classification Score")
|
| 207 |
+
|
| 208 |
+
|
| 209 |
with gr.Tab("Event Type Classification"):
|
| 210 |
gr.Markdown(
|
| 211 |
"""
|
|
|
|
| 278 |
hsummary = gr.Textbox(label="Summary")
|
| 279 |
|
| 280 |
qa_df = gr.DataFrame(visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
|
| 283 |
# with gr.Tab("Event Type Classification Eval"):
|