jayebaku commited on
Commit
12ff439
·
verified ·
1 Parent(s): c78f2ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -44
app.py CHANGED
@@ -12,30 +12,24 @@ HFTOKEN = os.environ["HF_TOKEN"]
12
 
13
 
14
 
15
- # js = """
16
- # async () => {
17
- # // Load Twitter Widgets script
18
- # const script = document.createElement("script");
19
- # script.onload = () => console.log("Twitter Widgets.js loaded");
20
- # script.src = "https://platform.twitter.com/widgets.js";
21
- # document.head.appendChild(script);
22
-
23
- # // Define a global function to reload Twitter widgets
24
- # globalThis.reloadTwitterWidgets = (tweetId) => {
25
- # if (typeof twttr !== 'undefined' && twttr.widgets) {
26
- # const container = document.getElementById('tweet-container');
 
 
27
 
28
- # // Clear existing content to prevent duplicates
29
- # if (container) container.innerHTML = '';
30
-
31
- # // Reload Twitter widgets
32
- # twttr.widgets.load();
33
-
34
- # // Create new tweet
35
-
36
- # };
37
- # }
38
- # """
39
 
40
  def T_on_select(evt: gr.SelectData):
41
  if evt.index[1] == 3:
@@ -174,30 +168,30 @@ def qa_summarise(selected_queries, qa_llm_model, text_field, data_df):
174
 
175
 
176
  with gr.Blocks(fill_width=True) as demo:
177
- js = """
178
- async () => {
179
- // Load Twitter Widgets script
180
- const script = document.createElement("script");
181
- script.onload = () => console.log("Twitter Widgets.js loaded");
182
- script.src = "https://platform.twitter.com/widgets.js";
183
- document.head.appendChild(script);
184
 
185
- // Define a global function to reload Twitter widgets
186
- globalThis.reloadTwitterWidgets = () => {
187
- // Select the container where tweets are inserted
188
- const tweetContainer = document.getElementById("tweet-container");
189
 
190
- if (tweetContainer) {
191
- tweetContainer.innerHTML = ""; // Clear previous tweets
192
- }
193
 
194
- // Reload Twitter widgets
195
- if (window.twttr && twttr.widgets) {
196
- twttr.widgets.load();
197
- }
198
- };
199
- }
200
- """
201
 
202
  demo.load(None,None,None,js=js)
203
 
 
12
 
13
 
14
 
15
+ js = """
16
+ async () => {
17
+ // Load Twitter Widgets script
18
+ const script = document.createElement("script");
19
+ script.onload = () => console.log("Twitter Widgets.js loaded");
20
+ script.src = "https://platform.twitter.com/widgets.js";
21
+ document.head.appendChild(script);
22
+
23
+ // Define a global function to reload Twitter widgets
24
+ globalThis.reloadTwitterWidgets = () => {
25
+ // Reload Twitter widgets
26
+ if (window.twttr && twttr.widgets) {
27
+ twttr.widgets.load();
28
+ }
29
 
30
+ };
31
+ }
32
+ """
 
 
 
 
 
 
 
 
33
 
34
  def T_on_select(evt: gr.SelectData):
35
  if evt.index[1] == 3:
 
168
 
169
 
170
  with gr.Blocks(fill_width=True) as demo:
171
+ # js = """
172
+ # async () => {
173
+ # // Load Twitter Widgets script
174
+ # const script = document.createElement("script");
175
+ # script.onload = () => console.log("Twitter Widgets.js loaded");
176
+ # script.src = "https://platform.twitter.com/widgets.js";
177
+ # document.head.appendChild(script);
178
 
179
+ # // Define a global function to reload Twitter widgets
180
+ # globalThis.reloadTwitterWidgets = () => {
181
+ # // Select the container where tweets are inserted
182
+ # const tweetContainer = document.getElementById("tweet-container");
183
 
184
+ # if (tweetContainer) {
185
+ # tweetContainer.innerHTML = ""; // Clear previous tweets
186
+ # }
187
 
188
+ # // Reload Twitter widgets
189
+ # if (window.twttr && twttr.widgets) {
190
+ # twttr.widgets.load();
191
+ # }
192
+ # };
193
+ # }
194
+ # """
195
 
196
  demo.load(None,None,None,js=js)
197