Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -32,12 +32,7 @@ js = """
|
|
32 |
"""
|
33 |
|
34 |
def T_on_select(evt: gr.SelectData):
|
35 |
-
|
36 |
-
# html = """<blockquote id="tweet-container" class="twitter-tweet" data-dnt="true" data-theme="dark">""" + \
|
37 |
-
# f"""\n<a href="https://twitter.com/anyuser/status/{evt.value}"></a></blockquote>"""
|
38 |
-
# else:
|
39 |
-
# html = f"""<h2>{evt.value}</h2>"""
|
40 |
-
return evt.value #html
|
41 |
|
42 |
def single_classification(text, event_model, threshold):
|
43 |
res = classify(text, event_model, HFTOKEN, threshold)
|
@@ -200,22 +195,21 @@ with gr.Blocks(fill_width=True) as demo:
|
|
200 |
|
201 |
gr.Markdown("""Select an ID cell in dataframe to view Embedded tweet""")
|
202 |
T_tweetID = gr.Textbox(visible=False)
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
with gr.Group():
|
207 |
T_data_filter = gr.Dropdown(visible=False)
|
208 |
T_tweet_embed = gr.HTML("""<div id="tweet-container"></div>""")
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
|
220 |
|
221 |
|
@@ -247,7 +241,7 @@ with gr.Blocks(fill_width=True) as demo:
|
|
247 |
info="This value sets a threshold by which texts classified flood or fire are accepted, \
|
248 |
higher values makes the classifier stricter (CAUTION: A value of 1 will set all predictions as none)", interactive=True)
|
249 |
|
250 |
-
with gr.Row():
|
251 |
with gr.Column():
|
252 |
gr.Markdown("""### Flood-related""")
|
253 |
flood_checkbox_output = gr.CheckboxGroup(label="Select ONLY incorrect classifications", interactive=True)
|
|
|
32 |
"""
|
33 |
|
34 |
def T_on_select(evt: gr.SelectData):
|
35 |
+
return evt.value
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def single_classification(text, event_model, threshold):
|
38 |
res = classify(text, event_model, HFTOKEN, threshold)
|
|
|
195 |
|
196 |
gr.Markdown("""Select an ID cell in dataframe to view Embedded tweet""")
|
197 |
T_tweetID = gr.Textbox(visible=False)
|
198 |
+
with gr.Group():
|
199 |
+
with gr.Row():
|
200 |
+
with gr.Column(scale=3):
|
|
|
201 |
T_data_filter = gr.Dropdown(visible=False)
|
202 |
T_tweet_embed = gr.HTML("""<div id="tweet-container"></div>""")
|
203 |
+
|
204 |
+
with gr.Column(scale=7):
|
205 |
+
T_data = gr.DataFrame(headers=["Texts", "event_label", "model_score", "IDs"],
|
206 |
+
wrap=True,
|
207 |
+
show_fullscreen_button=True,
|
208 |
+
show_copy_button=True,
|
209 |
+
show_row_numbers=True,
|
210 |
+
show_search="filter",
|
211 |
+
max_height=1000,
|
212 |
+
column_widths=["49%","17%","17%","17%"])
|
213 |
|
214 |
|
215 |
|
|
|
241 |
info="This value sets a threshold by which texts classified flood or fire are accepted, \
|
242 |
higher values makes the classifier stricter (CAUTION: A value of 1 will set all predictions as none)", interactive=True)
|
243 |
|
244 |
+
with gr.Row():
|
245 |
with gr.Column():
|
246 |
gr.Markdown("""### Flood-related""")
|
247 |
flood_checkbox_output = gr.CheckboxGroup(label="Select ONLY incorrect classifications", interactive=True)
|