jayebaku commited on
Commit
593adc9
·
verified ·
1 Parent(s): c5a5c67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -21
app.py CHANGED
@@ -32,12 +32,7 @@ js = """
32
  """
33
 
34
  def T_on_select(evt: gr.SelectData):
35
- # if evt.index[1] == 3:
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
- with gr.Row():
205
- with gr.Column(scale=4):
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
- with gr.Column(scale=6):
211
- T_data = gr.DataFrame(headers=["Texts", "event_label", "model_score", "IDs"],
212
- wrap=True,
213
- show_fullscreen_button=True,
214
- show_copy_button=True,
215
- show_row_numbers=True,
216
- show_search="filter",
217
- max_height=1000,
218
- column_widths=["49%","17%","17%","17%"])
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(): # XXX confirm this is not a problem later --equal_height=True
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)