Rams901 commited on
Commit
b68875e
1 Parent(s): b2fe8fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +194 -61
app.py CHANGED
@@ -27,13 +27,11 @@ embeddings = HuggingFaceEmbeddings()
27
  db = FAISS.load_local('db_full', embeddings)
28
 
29
  mp_docs = {}
30
- llm = ClaudeLLM()
31
- # ChatOpenAI(
32
- # temperature=0,
33
- # model='gpt-3.5-turbo-16k'
34
- # )
35
-
36
-
37
  def add_text(history, text):
38
 
39
  print(history)
@@ -41,12 +39,9 @@ def add_text(history, text):
41
 
42
  return history, ""
43
 
44
- pipeline = {'claude': (ClaudeLLM(), 0), 'gpt-3.5': (ChatOpenAI(temperature=0,model='gpt-3.5-turbo-16k'), 65), 'gpt-4': (ChatOpenAI(temperature=0, model='gpt-4'), 30)}
45
-
46
- def retrieve_thoughts(query, n):
47
-
48
- # print(db.similarity_search_with_score(query = query, k = k, fetch_k = k*10))
49
- docs_with_score = db.similarity_search_with_score(query = query, k = len(db.index_to_docstore_id.values()), fetch_k = len(db.index_to_docstore_id.values()))
50
  df = pd.DataFrame([dict(doc[0])['metadata'] for doc in docs_with_score], )
51
  df = pd.concat((df, pd.DataFrame([dict(doc[0])['page_content'] for doc in docs_with_score], columns = ['page_content'])), axis = 1)
52
  df = pd.concat((df, pd.DataFrame([doc[1] for doc in docs_with_score], columns = ['score'])), axis = 1)
@@ -54,30 +49,30 @@ def retrieve_thoughts(query, n):
54
  # TO-DO: What if user query doesn't match what we provide as documents
55
 
56
  tier_1 = df[df['score'] < 0.7]
57
- tier_2 = df[(df['score'] < 0.95) * (df["score"] > 0.7)]
58
-
59
 
60
- chunks_1 = tier_1.groupby(['title', 'url', '_id']).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
61
- tier_1_adjusted = tier_1.groupby(['title', 'url', '_id']).first().reset_index()[['_id', 'title', 'url']]
62
  tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
63
  tier_1_adjusted['content'] = chunks_1
64
 
65
- chunks_2 = tier_2.groupby(['title', 'url', '_id']).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
66
- tier_2_adjusted = tier_2.groupby(['title', 'url', '_id']).first().reset_index()[['_id', 'title', 'url']]
67
  tier_2_adjusted['content'] = chunks_2
68
 
69
- if n:
70
- tier_1_adjusted = tier_1_adjusted[:min(len(tier_1_adjusted), n)]
71
-
72
- print(len(tier_1_adjusted))
73
  # tier_1 = [doc[0] for doc in docs if ((doc[1] < 1))][:5]
74
  # tier_2 = [doc[0] for doc in docs if ((doc[1] > 0.7)*(doc[1] < 1.5))][10:15]
75
 
76
- return {'tier 1':tier_1_adjusted, 'tier 2': tier_2.loc[:5]}
77
 
78
- def qa_retrieve(query, llm):
79
-
80
- llm = pipeline["claude"][0]
 
 
 
 
 
81
 
82
  docs = ""
83
 
@@ -85,7 +80,7 @@ def qa_retrieve(query, llm):
85
  print(db)
86
 
87
  global mp_docs
88
- thoughts = retrieve_thoughts(query, 0)
89
  if not(thoughts):
90
 
91
  if mp_docs:
@@ -99,23 +94,24 @@ def qa_retrieve(query, llm):
99
  reference = tier_1[['ref', 'url', 'title']].to_dict('records')
100
 
101
  tier_1 = list(tier_1.apply(lambda x: f"[{int(x['ref'])}] title: {x['title']}\n Content: {x.content}", axis = 1).values)
102
- print(len(tier_1))
103
  tier_2 = list(tier_2.apply(lambda x: f"title: {x['title']}\n Content: {x.content}", axis = 1).values)
104
-
105
  print(f"QUERY: {query}\nTIER 1: {tier_1}\nTIER2: {tier_2}")
106
- # print(f"DOCS RETRIEVED: {mp_docs.values}")
107
 
 
108
  # Cynthesis Generation
 
 
 
109
  session_prompt = """ A bot that is open to discussions about different cultural, philosophical and political exchanges. You will use do different analysis to the articles provided to me. Stay truthful and if you weren't provided any resources give your oppinion only."""
110
  task = """Your primary responsibility is to identify multiple themes from the given articles. For each theme detected, you are to present it under three separate categories:
111
-
112
  1. Theme Title - An easy-to-understand title that encapsulates the core idea of the theme extracted from the article.
113
-
114
  2. Theme Description - An expanded elaboration that explores the theme in detail based on the arguments and points provided in the article.
115
-
116
  3. Quotes related to theme - Locate and provide at least one compelling quote from the article that directly supports or showcases the theme you have identified. This quote should serve as a specific evidence or example from the article text that corresponds directly to the developed theme.
117
-
118
- The extracted themes should be written in structured manner, ensuring clarity and meaningful correlation between the themes and the articles. Make sure your analysis is rooted in the arguments given in the article. Avoid including personal opinions or making generalizations that are not explicitly supported by the articles. """
119
 
120
 
121
  prompt = PromptTemplate(
@@ -123,28 +119,149 @@ def qa_retrieve(query, llm):
123
  template="""
124
  You are a {session_prompt}
125
  {task}
126
-
127
  query: {query}
128
-
129
  Articles:
130
  {articles}
131
 
132
-
133
  The extracted themes should be written in structured manner, ensuring clarity and meaningful correlation between the themes and the articles. Make sure your analysis is rooted in the arguments given in the article. Avoid including personal opinions or making generalizations that are not explicitly supported by the articles.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  """,
136
  )
137
 
138
 
139
  # llm = BardLLM()
140
- chain = LLMChain(llm=llm, prompt = prompt)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
- response = chain.run(query=query, articles="\n".join(tier_1), session_prompt = session_prompt, task = task)
 
143
 
144
- for i in range(5):
145
- response = response.replace(f'[{i}]', f"<span class='text-primary'>[{i}]</span>")
146
 
147
- # Generate related questions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  prompt_q = PromptTemplate(
149
  input_variables=[ "session_prompt", "articles"],
150
  template="""
@@ -154,29 +271,18 @@ def qa_retrieve(query, llm):
154
  Articles:
155
  {articles}
156
 
157
-
158
  Make sure not to ask specific questions, keep them general, short and concise.
159
  """,
160
  )
161
 
162
- chain_q = LLMChain(llm=ClaudeLLM(), prompt = prompt_q)
163
 
164
  questions = chain_q.run(session_prompt = session_prompt, articles = "\n".join(tier_2), )
165
- print(questions)
166
  questions = questions[questions.index('1'):]
167
 
168
- questions = [ remove_numbers(t).strip() for (i, t) in enumerate(questions.split('.')) if len(t) > 5][:5]
169
- print(questions)
170
-
171
- # TO-DO: initiate models in another function, refactor code to be reusable
172
-
173
- # json_resp = {'cynthesis': response, 'questions': questions, 'Reference': reference}
174
-
175
- return response, {'Reference': reference}
176
-
177
- def flush():
178
- return None
179
-
180
  examples = [
181
  ["Will Russia win the war in Ukraine?"],
182
 
@@ -184,9 +290,36 @@ examples = [
184
 
185
  demo = gr.Interface(fn=qa_retrieve, title="cicero-qa-api",
186
  inputs=gr.inputs.Textbox(lines=5, label="what would you like to learn about?"),
187
- outputs=[gr.components.Textbox(lines=3, label="Themes"),
188
- gr.components.JSON( label="Reference")],examples=examples)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
  demo.queue(concurrency_count = 4)
191
  demo.launch()
192
 
 
 
27
  db = FAISS.load_local('db_full', embeddings)
28
 
29
  mp_docs = {}
30
+ llm_4 = ChatOpenAI(
31
+ temperature=0,
32
+ model='gpt-4'
33
+ )
34
+ claude = ClaudeLLM()
 
 
35
  def add_text(history, text):
36
 
37
  print(history)
 
39
 
40
  return history, ""
41
 
42
+ def retrieve_thoughts(query, ):
43
+ # print(db.similarity_search_with_score(query = query, k = k, fetch_k = k*10))
44
+ docs_with_score = db.similarity_search_with_score(query = query, k = 1500, fetch_k = len(db.index_to_docstore_id.values()))
 
 
 
45
  df = pd.DataFrame([dict(doc[0])['metadata'] for doc in docs_with_score], )
46
  df = pd.concat((df, pd.DataFrame([dict(doc[0])['page_content'] for doc in docs_with_score], columns = ['page_content'])), axis = 1)
47
  df = pd.concat((df, pd.DataFrame([doc[1] for doc in docs_with_score], columns = ['score'])), axis = 1)
 
49
  # TO-DO: What if user query doesn't match what we provide as documents
50
 
51
  tier_1 = df[df['score'] < 0.7]
52
+ tier_2 = df[((df['score'] < 1) * (df["score"] > 0.7))]
 
53
 
54
+ chunks_1 = tier_1.groupby(['title', 'url', ]).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
55
+ tier_1_adjusted = tier_1.groupby(['title', 'url', ]).first().reset_index()[[ 'title', 'url']]
56
  tier_1_adjusted['ref'] = range(1, len(tier_1_adjusted) + 1 )
57
  tier_1_adjusted['content'] = chunks_1
58
 
59
+ chunks_2 = tier_2.groupby(['title', 'url', ]).apply(lambda x: "\n...\n".join(x.sort_values('id')['page_content'].values)).values
60
+ tier_2_adjusted = tier_2.groupby(['title', 'url', ]).first().reset_index()[[ 'title', 'url']]
61
  tier_2_adjusted['content'] = chunks_2
62
 
 
 
 
 
63
  # tier_1 = [doc[0] for doc in docs if ((doc[1] < 1))][:5]
64
  # tier_2 = [doc[0] for doc in docs if ((doc[1] > 0.7)*(doc[1] < 1.5))][10:15]
65
 
66
+ return {'tier 1':tier_1_adjusted.loc[:25], 'tier 2': tier_2.loc[:5]}
67
 
68
+ def get_references(query):
69
+ # TO-DO FINSIH UPP.
70
+ thoughts = retrieve_thoughts(query)
71
+ print(thoughts.keys())
72
+ tier_1 = thoughts['tier 1']
73
+ reference = tier_1[['ref', 'url', 'title']].to_dict('records')
74
+ return reference
75
+ def qa_themes(query,):
76
 
77
  docs = ""
78
 
 
80
  print(db)
81
 
82
  global mp_docs
83
+ thoughts = retrieve_thoughts(query)
84
  if not(thoughts):
85
 
86
  if mp_docs:
 
94
  reference = tier_1[['ref', 'url', 'title']].to_dict('records')
95
 
96
  tier_1 = list(tier_1.apply(lambda x: f"[{int(x['ref'])}] title: {x['title']}\n Content: {x.content}", axis = 1).values)
 
97
  tier_2 = list(tier_2.apply(lambda x: f"title: {x['title']}\n Content: {x.content}", axis = 1).values)
 
98
  print(f"QUERY: {query}\nTIER 1: {tier_1}\nTIER2: {tier_2}")
 
99
 
100
+ # print(f"DOCS RETRIEVED: {mp_docs.values}")
101
  # Cynthesis Generation
102
+
103
+
104
+ # Themes
105
  session_prompt = """ A bot that is open to discussions about different cultural, philosophical and political exchanges. You will use do different analysis to the articles provided to me. Stay truthful and if you weren't provided any resources give your oppinion only."""
106
  task = """Your primary responsibility is to identify multiple themes from the given articles. For each theme detected, you are to present it under three separate categories:
107
+
108
  1. Theme Title - An easy-to-understand title that encapsulates the core idea of the theme extracted from the article.
109
+
110
  2. Theme Description - An expanded elaboration that explores the theme in detail based on the arguments and points provided in the article.
111
+
112
  3. Quotes related to theme - Locate and provide at least one compelling quote from the article that directly supports or showcases the theme you have identified. This quote should serve as a specific evidence or example from the article text that corresponds directly to the developed theme.
113
+
114
+ Keep your answer direct and don't include your thoughts."""
115
 
116
 
117
  prompt = PromptTemplate(
 
119
  template="""
120
  You are a {session_prompt}
121
  {task}
 
122
  query: {query}
 
123
  Articles:
124
  {articles}
125
 
 
126
  The extracted themes should be written in structured manner, ensuring clarity and meaningful correlation between the themes and the articles. Make sure your analysis is rooted in the arguments given in the article. Avoid including personal opinions or making generalizations that are not explicitly supported by the articles.
127
+ Keep your answer direct and don't include your thoughts.
128
+ """,
129
+ )
130
+
131
+
132
+ # llm = BardLLM()
133
+ chain = LLMChain(llm=claude, prompt = prompt)
134
+
135
+ themes = chain.run(query=query, articles="\n".join(tier_1), session_prompt = session_prompt, task = task)
136
+ return themes
137
+
138
+ def qa_retrieve(query,):
139
+
140
+ docs = ""
141
+
142
+ global db
143
+ print(db)
144
+
145
+ global mp_docs
146
+ thoughts = retrieve_thoughts(query)
147
+ if not(thoughts):
148
+
149
+ if mp_docs:
150
+ thoughts = mp_docs
151
+ else:
152
+ mp_docs = thoughts
153
+
154
+ tier_1 = thoughts['tier 1']
155
+ tier_2 = thoughts['tier 2']
156
+
157
+ reference = tier_1[['ref', 'url', 'title']].to_dict('records')
158
+
159
+ tier_1 = list(tier_1.apply(lambda x: f"[{int(x['ref'])}] title: {x['title']}\n Content: {x.content}", axis = 1).values)
160
+ tier_2 = list(tier_2.apply(lambda x: f"title: {x['title']}\n Content: {x.content}", axis = 1).values)
161
+ print(f"QUERY: {query}\nTIER 1: {tier_1}\nTIER2: {tier_2}")
162
 
163
+ # print(f"DOCS RETRIEVED: {mp_docs.values}")
164
+ # Cynthesis Generation
165
+
166
+ session_prompt = """ A bot that is open to discussions about different cultural, philosophical and political exchanges. You will use do different analysis to the articles provided to me. Stay truthful and if you weren't provided any resources give your oppinion only."""
167
+ # task = """Create a coherent synthesis in which you use references to the id of articles provided and relevant to the query.
168
+
169
+ # Follow the example structure:
170
+
171
+ # The best wine to pair with steak depends on the cut of steak and the preparation. Here are some general guidelines for pairing wine with steak:
172
+ # - Choose a dry red wine. The rule of thumb is to choose dry red wines
173
+ # - leaner cuts of meat pair with lighter wines, while richer, fattier cuts pair up with high tannin wines that can cut through the fat [1].
174
+ # - Consider the cut of steak. Lighter red wines tend to go best with the leaner cuts of steak such as filet mignon, while more marbled, higher fat cuts of meat like a rib eye do well when accompanied by more robust red wines [3].
175
+ # - Take into account the preparation. For a spiced steak, go for a wine with lots of fruit to balance out the heat, like an Old Vine Zinfandel. And if you're drowning your steak in a decadent sauce, find a wine with enough body to stand up to it, like a Cabernet Sauvignon [5].
176
+ # - Popular wine choices include Cabernet Sauvignon, Pinot Noir, Zinfandel, Malbec, Syrah, and Merlot [2].
177
+ # Remember, the goal is to choose a wine that complements the cut of steak and not overwhelm or take away from the flavor of the meat [3]."
178
+ # """
179
+
180
+ prompt = PromptTemplate(
181
+ input_variables=["query", "session_prompt", "articles"],
182
+ template="""
183
+ You are a {session_prompt}
184
+ Create a coherent well-structured synthesis in which you use references to the id of articles provided and relevant to the query.
185
+
186
+ Follow the example structure, references are not provided but are found in the answer:
187
+ User: What are the secondary effects of covid?
188
+ Cynthesis: \nSecondary effects of COVID-19, often referred to as \"Long COVID\", are a significant concern. These effects are not limited to the acute phase of the disease but persist well past the first month, affecting various organ systems and leading to adverse outcomes such as all-cause death and hospitalization [1]. \n\nOne of the most alarming secondary effects is the increased risk of cardiovascular diseases. Studies have shown a 1.6-fold increased risk of stroke and a 2-fold higher risk of acute coronary disease in individuals who had COVID-19 [2]. These risks were observed even in younger populations, with a mean age of 44, and were prevalent after 30 days post-infection [2]. \n\nAnother study found that the adverse outcomes of COVID-19 could persist up to the 2-year mark, with the toll of adverse sequelae being worst during the first year [3]. The study also highlighted that individuals with severe COVID-19, who were hospitalized, were more likely to be afflicted with protracted symptoms and new medical diagnoses [3]. \n\nHowever, it's important to note that the risks associated with Long COVID might be most significant in the first few weeks post-infection and fade away as time goes on [4]. For instance, the chance of developing pulmonary embolism was found to be 32 times higher in the first month after testing positive for COVID-19 [4]. \n\nMoreover, the number of excess deaths in the U.S., which would indicate fatal consequences of mild infections at a delay of months or years, dropped to zero in April, about two months after the end of the winter surge, and have stayed relatively low ever since [4]. This suggests that a second wave of deaths—a long-COVID wave—never seems to break [4]. \n\nIn conclusion, while the secondary effects of COVID-19 are significant and can persist for a long time, the most severe risks seem to occur in the first few weeks post-infection and then gradually decrease. However, the full extent of the long-term effects of COVID-19 is still unknown, and further research is needed to fully understand the ways and extent COVID-19 has affected us.",
189
+
190
+ query: {query}
191
+
192
+ Articles:
193
+ {articles}
194
+
195
+ Make sure to quote the article used if the argument corresponds to the query.
196
+ Use careful reasoning and professional writing for the synthesis. No need to mention your interaction with articles.
197
+ Remember not to mention articles used at the beginning of sentences, keep it cohesive and rich in text while referencing as much as possible of sources given.
198
  """,
199
  )
200
 
201
 
202
  # llm = BardLLM()
203
+ chain = LLMChain(llm=llm_4, prompt = prompt)
204
+
205
+ consensus = chain.run(query=query, articles="\n".join(tier_1), session_prompt = session_prompt,).strip()
206
+
207
+ intro = qa_intro(query, consensus, tier_1)
208
+ cynthesis = intro + "\n\n" + consensus
209
+ # for i in range(1, len(tier_1)+1):
210
+ # response = response.replace(f'[{i}]', f"<span class='text-primary'>[{i}]</span>")
211
+
212
+
213
+ # json_resp = {'cynthesis': response, 'questions': questions, 'reference': reference}
214
+
215
+ return cynthesis
216
+ def qa_intro(query, cynthesis, tier_1,):
217
+
218
+
219
+ llm = ClaudeLLM()
220
+ llm_4 = ChatOpenAI(
221
+ temperature=0,
222
+ model='gpt-3.5-turbo-16k'
223
+ )
224
+
225
+ session_prompt = """ A bot that is open to discussions about different cultural, philosophical and political exchanges. You will use do different analysis to the articles provided to me. Stay truthful and if you weren't provided any resources give your oppinion only."""
226
+
227
+ prompt = PromptTemplate(
228
+ input_variables=["query", "cynthesis", "articles"],
229
+ template="""
230
+ Give me an introduction to the following consensus without repeating how it starts. Consider this an abstract. And after finishing the introduction, pick one quote from the sources given below.
231
+
232
+ query: {query}
233
+ Here's the consensus: {cynthesis}
234
+
235
+ We have the opportunity to give an introduction to this synthesis without repeating information found.
236
+ Pick an opening quote from the sources given below\n
237
+ ---------\n
238
+ {articles}
239
+ ---------\n
240
 
241
+ Don't forget that your job is to only provide an introduction, abstract part that introduces the synthesis without repeating it and then pick one general quote from the sources given.""",
242
+ )
243
 
 
 
244
 
245
+ # llm = BardLLM()
246
+ chain = LLMChain(llm=llm_4, prompt = prompt)
247
+
248
+ intro = chain.run(query=query, articles="\n".join(tier_1), cynthesis = cynthesis)
249
+ return intro.strip()
250
+
251
+ def qa_faqs(query):
252
+
253
+ thoughts = retrieve_thoughts(query)
254
+
255
+ # tier_1 = thoughts['tier 1']
256
+ tier_2 = thoughts['tier 2']
257
+
258
+ # reference = tier_1[['ref', 'url', 'title']].to_dict('records')
259
+
260
+ # tier_1 = list(tier_1.apply(lambda x: f"[{int(x['ref'])}] title: {x['title']}\n Content: {x.content}", axis = 1).values)
261
+ tier_2 = list(tier_2.apply(lambda x: f"title: {x['title']}\n Content: {x.content}", axis = 1).values)
262
+ # Generate related questions
263
+ session_prompt = """ A bot that is open to discussions about different cultural, philosophical and political exchanges. You will use do different analysis to the articles provided to me. Stay truthful and if you weren't provided any resources give your oppinion only."""
264
+
265
  prompt_q = PromptTemplate(
266
  input_variables=[ "session_prompt", "articles"],
267
  template="""
 
271
  Articles:
272
  {articles}
273
 
 
274
  Make sure not to ask specific questions, keep them general, short and concise.
275
  """,
276
  )
277
 
278
+ chain_q = LLMChain(llm=claude, prompt = prompt_q)
279
 
280
  questions = chain_q.run(session_prompt = session_prompt, articles = "\n".join(tier_2), )
 
281
  questions = questions[questions.index('1'):]
282
 
283
+ questions = [ t.strip() for (i, t) in enumerate(questions.split('\n\n')) if len(t) > 5][:5]
284
+
285
+ return "\n\n".join(questions)
 
 
 
 
 
 
 
 
 
286
  examples = [
287
  ["Will Russia win the war in Ukraine?"],
288
 
 
290
 
291
  demo = gr.Interface(fn=qa_retrieve, title="cicero-qa-api",
292
  inputs=gr.inputs.Textbox(lines=5, label="what would you like to learn about?"),
293
+ outputs="json",examples=examples)
294
+
295
+ def parallel_greet_claude(batch, ):
296
+
297
+ batch = ast.literal_eval(batch)
298
+ query, thoughts = batch['query'], batch['thoughts']
299
+ print(thoughts)
300
+ result = qa_retrieve(query, "claude", thoughts)
301
+
302
+ return result
303
+
304
+ # examples = [
305
+ # ["Will Russia win the war in Ukraine?"],
306
+ # ["Covid Global Impact and what's beyond that"]
307
+ # ]
308
+
309
+ cynthesis = gr.Interface(fn = qa_retrieve, inputs = "text", outputs = gr.components.Textbox(lines=3, label="Cynthesis"))
310
+ questions = gr.Interface(fn = qa_faqs, inputs = "text", outputs = gr.components.Textbox(lines=3, label="Related Questions"))
311
+ themes = gr.Interface(fn = qa_themes, inputs = "text", outputs = gr.components.Textbox(lines=3, label="themes"))
312
+
313
+ # gpt_3 = gr.Interface(fn = parallel_greet_gpt_3, inputs = "text", outputs = gr.components.Textbox(lines=3, label="GPT3.5"))
314
+ # gpt_4 = gr.Interface(fn = parallel_greet_gpt_4, inputs = "text", outputs = gr.components.Textbox(lines=3, label="GPT4"))
315
+ # claude = gr.Interface(fn = parallel_greet_claude, inputs = "text", outputs = gr.components.Textbox(lines=3, label="Claude"))
316
+ reference = gr.Interface(fn = get_references, inputs = "text", outputs = "json", label = "Reference")
317
+
318
+ demo = gr.Parallel(cynthesis, themes, questions, reference)
319
+
320
+ # demo = gr.Series(references, cynthesis, themes)
321
 
322
  demo.queue(concurrency_count = 4)
323
  demo.launch()
324
 
325
+