Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -11,22 +11,22 @@ HFTOKEN = os.environ["HF_TOKEN"]
|
|
11 |
|
12 |
|
13 |
|
14 |
-
js = """
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
"""
|
30 |
|
31 |
def T_on_select(evt: gr.SelectData):
|
32 |
|
@@ -166,6 +166,22 @@ def qa_summarise(selected_queries, qa_llm_model, text_field, data_df):
|
|
166 |
|
167 |
|
168 |
with gr.Blocks(fill_width=True) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
demo.load(None,None,None,js=js)
|
171 |
|
@@ -362,7 +378,7 @@ with gr.Blocks(fill_width=True) as demo:
|
|
362 |
outputs=[T_data, T_data_ss_state, T_data_filter]
|
363 |
)
|
364 |
|
365 |
-
T_data.select(T_on_select, None, T_tweet_embed)
|
366 |
|
367 |
@T_data_filter.input(inputs=[T_data_ss_state, T_data_filter], outputs=T_data)
|
368 |
def filter_df(df, filter):
|
|
|
11 |
|
12 |
|
13 |
|
14 |
+
# js = """
|
15 |
+
# async () => {
|
16 |
+
# // Load Twitter Widgets script
|
17 |
+
# const script = document.createElement("script");
|
18 |
+
# script.onload = () => console.log("Twitter Widgets.js loaded");
|
19 |
+
# script.src = "https://platform.twitter.com/widgets.js";
|
20 |
+
# document.head.appendChild(script);
|
21 |
+
|
22 |
+
# // Define a global function to reload Twitter widgets
|
23 |
+
# globalThis.reloadTwitterWidgets = () => {
|
24 |
+
# if (window.twttr && twttr.widgets) {
|
25 |
+
# twttr.widgets.load();
|
26 |
+
# }
|
27 |
+
# };
|
28 |
+
# }
|
29 |
+
# """
|
30 |
|
31 |
def T_on_select(evt: gr.SelectData):
|
32 |
|
|
|
166 |
|
167 |
|
168 |
with gr.Blocks(fill_width=True) as demo:
|
169 |
+
js = """
|
170 |
+
async () => {
|
171 |
+
// Load Twitter Widgets script
|
172 |
+
const script = document.createElement("script");
|
173 |
+
script.onload = () => console.log("Twitter Widgets.js loaded");
|
174 |
+
script.src = "https://platform.twitter.com/widgets.js";
|
175 |
+
document.head.appendChild(script);
|
176 |
+
|
177 |
+
// Define a global function to reload Twitter widgets
|
178 |
+
globalThis.reloadTwitterWidgets = () => {
|
179 |
+
if (window.twttr && twttr.widgets) {
|
180 |
+
twttr.widgets.load();
|
181 |
+
}
|
182 |
+
};
|
183 |
+
}
|
184 |
+
"""
|
185 |
|
186 |
demo.load(None,None,None,js=js)
|
187 |
|
|
|
378 |
outputs=[T_data, T_data_ss_state, T_data_filter]
|
379 |
)
|
380 |
|
381 |
+
T_data.select(T_on_select, None, T_tweet_embed).then(fn=None, js="reloadTwitterWidgets()")
|
382 |
|
383 |
@T_data_filter.input(inputs=[T_data_ss_state, T_data_filter], outputs=T_data)
|
384 |
def filter_df(df, filter):
|