Spaces:
Runtime error
Runtime error
Joan Giner
commited on
Commit
•
3d1c096
1
Parent(s):
f120573
First commit
Browse files- gradio_app.py +641 -0
- packages.txt +1 -0
- requirements.txt +317 -0
gradio_app.py
ADDED
@@ -0,0 +1,641 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
from langchain.embeddings import OpenAIEmbeddings
|
4 |
+
from langchain.text_splitter import CharacterTextSplitter, RecursiveCharacterTextSplitter
|
5 |
+
from langchain.vectorstores.faiss import FAISS
|
6 |
+
from langchain.chains.question_answering import load_qa_chain
|
7 |
+
from langchain.chains import LLMChain
|
8 |
+
from langchain.llms import OpenAI
|
9 |
+
from langchain import PromptTemplate
|
10 |
+
from langchain.docstore.document import Document
|
11 |
+
import pandas as pd
|
12 |
+
import os
|
13 |
+
import scipdf ## You need a Gorbid service available
|
14 |
+
import tabula ## You need to have the Java Tabula installed in the environment
|
15 |
+
from gradio import DataFrame
|
16 |
+
import asyncio
|
17 |
+
from transformers import pipeline
|
18 |
+
from dotenv import load_dotenv
|
19 |
+
import json
|
20 |
+
load_dotenv()
|
21 |
+
|
22 |
+
## You api key from vendors or hugginface
|
23 |
+
openai.api_key=os.getenv("OPEN_AI_API_KEY")
|
24 |
+
LLMClient = OpenAI(model_name='text-davinci-003', openai_api_key=openai.api_key,temperature=0)
|
25 |
+
|
26 |
+
# Extract text from PDF file using SCIPDF and Gorbid service (you need gorbid to use it)
|
27 |
+
def extract_text_from_pdf(file_path):
|
28 |
+
article_dict = scipdf.parse_pdf_to_dict(file_path, soup=True,return_coordinates=False, grobid_url="https://kermitt2-grobid.hf.space") # return dictionary
|
29 |
+
print("parsed")
|
30 |
+
source = article_dict.find("sourcedesc")
|
31 |
+
authors = source.find_all("persname")
|
32 |
+
finaltext = article_dict['title'] + " \n\n " + article_dict['authors'] + " \n\n Abstract: " + article_dict['abstract'] + " \n\n "
|
33 |
+
sections = []
|
34 |
+
for section in article_dict['sections']:
|
35 |
+
sec = section['heading'] + ": "
|
36 |
+
if(isinstance(section['text'], str)):
|
37 |
+
finaltext = finaltext + sec + section['text'] + " \n\n "
|
38 |
+
else:
|
39 |
+
for text in section['text']:
|
40 |
+
sec = sec + text+ " \n\n "
|
41 |
+
finaltext = finaltext + sec
|
42 |
+
return finaltext
|
43 |
+
|
44 |
+
# Extract and transform the tables of the papers
|
45 |
+
async def get_tables(docsearch,chain_table,input_file):
|
46 |
+
print("Getting tables")
|
47 |
+
table_texts = []
|
48 |
+
dfs = tabula.read_pdf(input_file.name, pages='all')
|
49 |
+
for idx, table in enumerate(dfs):
|
50 |
+
query = "Table "+str(idx+1)+":"
|
51 |
+
docs = docsearch.similarity_search(query, k=4)
|
52 |
+
#result = chain_table({"context":docs,"table":table})
|
53 |
+
table_texts.append(async_table_generate(docs, table, chain_table))
|
54 |
+
#print(query + " "+ result['text'])
|
55 |
+
#table_texts.append(query + " "+ result['text'])
|
56 |
+
table_texts = await asyncio.gather(*table_texts)
|
57 |
+
for table in table_texts:
|
58 |
+
docsearch.add_texts(table[1])
|
59 |
+
return docsearch
|
60 |
+
|
61 |
+
def extract_text_clean(file_path):
|
62 |
+
file_extension = os.path.splitext(file_path.name)[1]
|
63 |
+
if file_extension == ".pdf":
|
64 |
+
all_text = extract_text_from_pdf(file_path.name)
|
65 |
+
return all_text
|
66 |
+
elif file_extension == ".txt":
|
67 |
+
with open(file_path.name) as f:
|
68 |
+
all_text = f.read()
|
69 |
+
return all_text
|
70 |
+
|
71 |
+
async def prepare_data(input_file, chain_table, apikey):
|
72 |
+
#with open(input_file.name) as f:
|
73 |
+
# documentation = f.read()
|
74 |
+
file_name = input_file.name.split("/")[-1]
|
75 |
+
|
76 |
+
|
77 |
+
# Process text and get the embeddings
|
78 |
+
filepath = "./vectors/"+file_name
|
79 |
+
if not apikey:
|
80 |
+
apikey = openai.api_key
|
81 |
+
gr.Error("Please set your api key")
|
82 |
+
embeddings = OpenAIEmbeddings(openai_api_key=openai.api_key)
|
83 |
+
if os.path.isfile(filepath+"/index.faiss"):
|
84 |
+
|
85 |
+
# file exists
|
86 |
+
docsearch = FAISS.load_local(filepath,embeddings=embeddings)
|
87 |
+
|
88 |
+
print("We get the embeddings from local store")
|
89 |
+
else:
|
90 |
+
#progress(0.40, desc="Detected new document. Splitting and generating the embeddings")
|
91 |
+
print("We generate the embeddings using thir-party service")
|
92 |
+
# Get extracted running text
|
93 |
+
text = extract_text_clean(input_file)
|
94 |
+
|
95 |
+
# Configure the text splitter and embeddings
|
96 |
+
text_splitter = RecursiveCharacterTextSplitter.from_tiktoken_encoder(chunk_size=250, chunk_overlap=10, separators=[".", ",", " \n\n "])
|
97 |
+
|
98 |
+
# Split, and clean
|
99 |
+
texts = text_splitter.split_text(text)
|
100 |
+
for idx, text in enumerate(texts):
|
101 |
+
texts[idx] = text.replace('\n',' ')
|
102 |
+
print("Creating embeddings")
|
103 |
+
# Create an index search
|
104 |
+
docsearch = FAISS.from_texts(texts, embeddings, metadatas=[{"source": i} for i in range(len(texts))])
|
105 |
+
|
106 |
+
# Extract and prepare tables
|
107 |
+
# progress(0.60, desc="Embeddings generated, parsing and transforming tables")
|
108 |
+
if (os.path.splitext(input_file.name)[1] == '.pdf'):
|
109 |
+
docsearch = await get_tables(docsearch,chain_table,input_file)
|
110 |
+
|
111 |
+
# Save the index locally
|
112 |
+
FAISS.save_local(docsearch, "./vectors/"+file_name)
|
113 |
+
|
114 |
+
return docsearch
|
115 |
+
|
116 |
+
def build_chains(apikey):
|
117 |
+
if not apikey:
|
118 |
+
apikey = openai.api_key
|
119 |
+
gr.Error("Please set your api key")
|
120 |
+
LLMClient = OpenAI(model_name='text-davinci-003',openai_api_key=apikey,temperature=0)
|
121 |
+
## In-context prompt
|
122 |
+
prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
123 |
+
Question: {question}
|
124 |
+
###
|
125 |
+
Context:
|
126 |
+
{context}
|
127 |
+
###
|
128 |
+
Helpful answer:
|
129 |
+
"""
|
130 |
+
in_context_prompt = PromptTemplate(
|
131 |
+
input_variables=["context","question"],
|
132 |
+
template=prompt_template,
|
133 |
+
)
|
134 |
+
chain_incontext = load_qa_chain(LLMClient, chain_type="stuff", prompt=in_context_prompt)
|
135 |
+
|
136 |
+
# Table extraction prompts
|
137 |
+
## Table prompt to transform parsed tables in natural text
|
138 |
+
prompt_template = """Given the following table in HTML, and the given context related the table: Translate the content of the table into natural language.
|
139 |
+
###
|
140 |
+
Context:
|
141 |
+
{context}
|
142 |
+
###
|
143 |
+
Table: {table}
|
144 |
+
###
|
145 |
+
Table translation:
|
146 |
+
"""
|
147 |
+
table_prompt = PromptTemplate(
|
148 |
+
input_variables=["context","table"],
|
149 |
+
template=prompt_template,
|
150 |
+
)
|
151 |
+
chain_table = LLMChain(llm=LLMClient, prompt=table_prompt)
|
152 |
+
|
153 |
+
return chain_incontext, chain_table
|
154 |
+
|
155 |
+
async def async_table_generate(docs,table,chain):
|
156 |
+
|
157 |
+
resp = await chain.arun({"context": docs, "table": table})
|
158 |
+
#resp = "Description of the team, the type, and the demographics information, Description of the team, the type, and the demographics information"
|
159 |
+
return resp
|
160 |
+
|
161 |
+
async def async_generate(dimension, docs,question,chain):
|
162 |
+
resp = await chain.arun({"input_documents": docs, "question": question})
|
163 |
+
#resp = "Description of the team, the type, and the demographics information, Description of the team, the type, and the demographics information"
|
164 |
+
return [dimension, resp]
|
165 |
+
|
166 |
+
async def get_gathering_dimension(docsearch, incontext_prompt, retrieved_docs):
|
167 |
+
dimensions = [
|
168 |
+
{"Gathering description":"""Provide a summary of how the data of the dataset has been collected? Please avoid mention the annotation process or data preparation processes"""},
|
169 |
+
{"Gathering type":"""Which of the following types corresponds to the gathering process mentioned in the context?
|
170 |
+
|
171 |
+
Types: Web API, Web Scrapping, Sensors, Manual Human Curator, Software collection, Surveys, Observations, Interviews, Focus groups, Document analysis, Secondary data analysis, Physical data collection, Self-reporting, Experiments, Direct measurement, Interviews, Document analysis, Secondary data analysis, Physical data collection, Self-reporting, Experiments, Direct measurement, Customer feedback data, Audio or video recordings, Image data, Biometric data, Medical or health data, Financial data, Geographic or spatial data, Time series data, User-generated content data.
|
172 |
+
|
173 |
+
Answer with "Others", if you are unsure. Please answer with only the type"""},
|
174 |
+
{"Gathering team": """Who was the team who collect the data?"""},
|
175 |
+
{"Team Type": """The data was collected by an internal team, an external team, or crowdsourcing team?""" },
|
176 |
+
{"Team Demographics": "Are the any demographic information of team gathering the data?"},
|
177 |
+
{"Timeframe ":""" Which are the timeframe when the data was collected?
|
178 |
+
If present, answer only with the collection timeframe of the data. If your are not sure, or there is no mention, just answers 'not provided'"""},
|
179 |
+
{"Sources": """Which is the source of the data during the collection process? Answer solely with the name of the source""" },
|
180 |
+
{"Infrastructure": """Which tools or infrastructure has been used during the collection process?"""},
|
181 |
+
{"Localization": """Which are the places where data has been collected?
|
182 |
+
If present, answer only with the collection timeframe of the data. If your are not sure, or there is no mention, just answers 'not provided'"""}
|
183 |
+
|
184 |
+
]
|
185 |
+
|
186 |
+
results = []
|
187 |
+
for dimension in dimensions:
|
188 |
+
for title, question in dimension.items():
|
189 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
190 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
191 |
+
|
192 |
+
answers = await asyncio.gather(*results)
|
193 |
+
return answers
|
194 |
+
|
195 |
+
async def get_annotation_dimension(docsearch, incontext_prompt, retrieved_docs):
|
196 |
+
dimensions = [
|
197 |
+
{"Annotation description":"""How the data of the has been annotated or labelled? Provide a short summary of the annotation process"""},
|
198 |
+
{"Annotation type":""" Which of the following category corresponds to the annotation
|
199 |
+
process mentioned in the context?
|
200 |
+
|
201 |
+
Categories: Bounding boxes, Lines and splines, Semantinc Segmentation, 3D cuboids, Polygonal segmentation, Landmark and key-point, Image and video annotations, Entity annotation, Content and textual categorization
|
202 |
+
|
203 |
+
If you are not sure, answer with 'others'. Please answer only with the categories provided in the context. """},
|
204 |
+
{"Labels":""" Which are the specific labels of the dataset? Can you enumerate it an provide a description of each one?"""},
|
205 |
+
{"Team Description": """Who has annotated the data?"""},
|
206 |
+
{"Team type": """The data was annotated by an internal team, an external team, or crowdsourcing team?""" },
|
207 |
+
{"Team Demographics": """Is there any demographic information about the team who annotate the data?"""},
|
208 |
+
{"Infrastructure": """Which tool has been used to annotate or label the dataset?"""},
|
209 |
+
{"Validation": """How the quality of the labels have been validated?""" }
|
210 |
+
]
|
211 |
+
|
212 |
+
results = []
|
213 |
+
for dimension in dimensions:
|
214 |
+
for title, question in dimension.items():
|
215 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
216 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
217 |
+
|
218 |
+
answers = await asyncio.gather(*results)
|
219 |
+
return answers
|
220 |
+
|
221 |
+
async def get_social_concerns_dimension(docsearch, incontext_prompt, retrieved_docs):
|
222 |
+
dimensions = [
|
223 |
+
{"Representetiveness":"""Are there any social group that could be misrepresented in the dataset?"""},
|
224 |
+
{"Biases":"""Is there any potential bias or imbalance in the data?"""},
|
225 |
+
{"Sensitivity":""" Are there sensitive data, or data that can be offensive for people in the dataset?"""},
|
226 |
+
{"Privacy":""" Is there any privacy issues on the data?"""},
|
227 |
+
|
228 |
+
]
|
229 |
+
|
230 |
+
results = []
|
231 |
+
for dimension in dimensions:
|
232 |
+
for title, question in dimension.items():
|
233 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
234 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
235 |
+
|
236 |
+
answers = await asyncio.gather(*results)
|
237 |
+
return answers
|
238 |
+
|
239 |
+
async def get_uses_dimension(docsearch, incontext_prompt, retrieved_docs):
|
240 |
+
dimensions = [
|
241 |
+
{"Purposes":"""Which are the purpose or purposes of the dataset?"""},
|
242 |
+
{"Gaps":"""Which are the gaps the dataset intend to fill?"""},
|
243 |
+
{"Task":"""Which machine learning tasks the dataset inteded for?:"""},
|
244 |
+
{"Recommended":"""For which applications the dataset is recommended?"""},
|
245 |
+
{"Non-Recommneded":"""Is there any non-recommneded application for the dataset? If you are not sure, or there is any non-recommended use of the dataset metioned in the context, just answer with "no"."""},
|
246 |
+
]
|
247 |
+
results = []
|
248 |
+
for dimension in dimensions:
|
249 |
+
for title, question in dimension.items():
|
250 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
251 |
+
if (title == "Task"):
|
252 |
+
question = """Which of the following ML tasks for the dataset best matches the context?
|
253 |
+
|
254 |
+
Tasks: text-classification, question-answering, text-generation, token-classification, translation,
|
255 |
+
fill-mask, text-retrieval, conditional-text-generation, sequence-modeling, summarization, other,
|
256 |
+
structure-prediction, information-retrieval, text2text-generation, zero-shot-retrieval,
|
257 |
+
zero-shot-information-retrieval, automatic-speech-recognition, image-classification, speech-processing,
|
258 |
+
text-scoring, audio-classification, conversational, question-generation, image-to-text, data-to-text,
|
259 |
+
classification, object-detection, multiple-choice, text-mining, image-segmentation, dialog-response-generation,
|
260 |
+
named-entity-recognition, sentiment-analysis, machine-translation, tabular-to-text, table-to-text, simplification,
|
261 |
+
sentence-similarity, zero-shot-classification, visual-question-answering, text_classification, time-series-forecasting,
|
262 |
+
computer-vision, feature-extraction, symbolic-regression, topic modeling, one liner summary, email subject, meeting title,
|
263 |
+
text-to-structured, reasoning, paraphrasing, paraphrase, code-generation, tts, image-retrieval, image-captioning,
|
264 |
+
language-modelling, video-captionning, neural-machine-translation, transkation, text-generation-other-common-sense-inference,
|
265 |
+
text-generation-other-discourse-analysis, text-to-tabular, text-generation-other-code-modeling, other-text-search
|
266 |
+
|
267 |
+
If you are not sure answer with just with "others".
|
268 |
+
Please, answer only with one or some of the provided tasks """
|
269 |
+
|
270 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
271 |
+
|
272 |
+
answers = await asyncio.gather(*results)
|
273 |
+
return answers
|
274 |
+
|
275 |
+
async def get_contributors_dimension(docsearch, incontext_prompt, retrieved_docs):
|
276 |
+
dimensions = [
|
277 |
+
{"Authors":"""Who are the authors of the dataset """},
|
278 |
+
{"Funders":"""Is there any organization which supported or funded the creation of the dataset?"""},
|
279 |
+
{"Maintainers":"""Who are the maintainers of the dataset?"""},
|
280 |
+
{"Erratums":"""Is there any data retention limit in the dataset? If you are not sure, or there is no retention limit just answer with "no"."""},
|
281 |
+
{"Data Retention Policies":"""Is there any data retention policies policiy of the dataset? If you are not sure, or there is no retention policy just answer with "no"."""},
|
282 |
+
]
|
283 |
+
|
284 |
+
results = []
|
285 |
+
for dimension in dimensions:
|
286 |
+
for title, question in dimension.items():
|
287 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
288 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
289 |
+
|
290 |
+
answers = await asyncio.gather(*results)
|
291 |
+
return answers
|
292 |
+
|
293 |
+
async def get_composition_dimension(docsearch, incontext_prompt, retrieved_docs):
|
294 |
+
dimensions = [
|
295 |
+
{"File composition":"""Can you provide a description of each files the dataset is composed of?"""},
|
296 |
+
{"Attributes":"""Can you enumerate the different attributes present in the dataset? """},
|
297 |
+
{"Trainig splits":"""The paper mentions any recommended data split of the dataset?"""},
|
298 |
+
{"Relevant statistics":"""Are there relevant statistics or distributions of the dataset? """},
|
299 |
+
]
|
300 |
+
|
301 |
+
results = []
|
302 |
+
for dimension in dimensions:
|
303 |
+
for title, question in dimension.items():
|
304 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
305 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
306 |
+
|
307 |
+
answers = await asyncio.gather(*results)
|
308 |
+
return answers
|
309 |
+
|
310 |
+
async def get_distribution_dimension(docsearch, incontext_prompt, retrieved_docs):
|
311 |
+
dimensions = [
|
312 |
+
{"Data repository":"""Is there a link to the a repository containing the data? If you are not sure, or there is no link to the repository just answer with "no"."""},
|
313 |
+
{"Licence":"""Which is the license of the dataset. If you are not sure, or there is mention to a license of the dataset in the context, just answer with "no". """},
|
314 |
+
{"Deprecation policies":"""Is there any deprecation plan or policy of the dataset?
|
315 |
+
"""},
|
316 |
+
|
317 |
+
]
|
318 |
+
|
319 |
+
results = []
|
320 |
+
for dimension in dimensions:
|
321 |
+
for title, question in dimension.items():
|
322 |
+
docs = docsearch.similarity_search(question, k=retrieved_docs)
|
323 |
+
results.append(async_generate(title, docs,question,incontext_prompt))
|
324 |
+
|
325 |
+
answers = await asyncio.gather(*results)
|
326 |
+
return answers
|
327 |
+
|
328 |
+
def get_warnings(results):
|
329 |
+
warnings = []
|
330 |
+
classifier = pipeline("zero-shot-classification", model="valhalla/distilbart-mnli-12-1")
|
331 |
+
for result in results:
|
332 |
+
if(result[0] == "Team Demographics"):
|
333 |
+
classifications = classifier(result[1], ["Have demographics information","Do not have demographics information"])
|
334 |
+
if(classifications['labels'][0] == 'Do not have demographics information'):
|
335 |
+
print("Dimension: "+result[0]+" is missing. Inserting a warning")
|
336 |
+
warnings.append(result[0]+" is missing. This information is relevant to evaluate the quality of the labels")
|
337 |
+
if(result[0] == "Localization"):
|
338 |
+
classifications = classifier(result[1], ["Is a localization","Is not a localization"])
|
339 |
+
if(classifications['labels'][0] == 'Is not a localization'):
|
340 |
+
print("Dimension: "+result[0]+" is missing. Inserting a warning")
|
341 |
+
warnings.append(result[0]+" is missing. Please indicate where the data has been collected")
|
342 |
+
if(result[0] == "Time Localization"):
|
343 |
+
classifications = classifier(result[1], ["It is a date","It is not a date"])
|
344 |
+
if(classifications['labels'][0] == 'Is not a localization'):
|
345 |
+
print("Dimension: "+result[0]+" is missing. Inserting a warning")
|
346 |
+
warnings.append(result[0]+" is missing. Please indicate when the data has been collected")
|
347 |
+
if len(warnings) == 0:
|
348 |
+
warnings.append("No warnings")
|
349 |
+
return warnings
|
350 |
+
|
351 |
+
# Define function to handle the Gradio interface
|
352 |
+
async def annotate_only(input_file, apikey):
|
353 |
+
#progress(0, desc="Starting")
|
354 |
+
# Build the chains
|
355 |
+
chain_incontext, chain_table = build_chains(apikey)
|
356 |
+
# Prepare the data
|
357 |
+
#progress(0.20, desc="Preparing data: Generating embeddings, splitting text, and adding transformed tables")
|
358 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
359 |
+
# Get annotation dimensions
|
360 |
+
#progress(0.40, desc="Extracting dimensions")
|
361 |
+
results = await get_annotation_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
362 |
+
# Get warning
|
363 |
+
#progress(0.80, desc="Generating Warning")
|
364 |
+
warnings = get_warnings(results)
|
365 |
+
|
366 |
+
# Build results in the correct format for the Gradio front-end
|
367 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
368 |
+
return results, gr.update(value=pd.DataFrame(warnings,columns=['Warnings:']), visible=True)
|
369 |
+
# Define function to handle the Gradio interface
|
370 |
+
async def uses_only(input_file, apikey):
|
371 |
+
# Build the chains
|
372 |
+
chain_incontext, chain_table = build_chains(apikey)
|
373 |
+
# Prepare the data
|
374 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
375 |
+
# Get annotation dimensions
|
376 |
+
results = await get_uses_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
377 |
+
# Get warning
|
378 |
+
warnings = get_warnings(results)
|
379 |
+
|
380 |
+
# Build results in the correct format for the Gradio front-end
|
381 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
382 |
+
return results, gr.update(value=pd.DataFrame(warnings,columns=['Warnings:']), visible=True)
|
383 |
+
|
384 |
+
# Define function to handle the Gradio interface
|
385 |
+
async def distribution_only(input_file, apikey):
|
386 |
+
# Build the chains
|
387 |
+
chain_incontext, chain_table = build_chains(apikey)
|
388 |
+
# Prepare the data
|
389 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
390 |
+
# Get annotation dimensions
|
391 |
+
results = await get_distribution_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
392 |
+
# Get warning
|
393 |
+
warnings = get_warnings(results)
|
394 |
+
|
395 |
+
# Build results in the correct format for the Gradio front-end
|
396 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
397 |
+
return results, gr.update(value=pd.DataFrame(warnings,columns=['Warnings:']), visible=True)
|
398 |
+
# Define function to handle the Gradio interface
|
399 |
+
async def social_cocerns_only(input_file, apikey):
|
400 |
+
# Build the chains
|
401 |
+
chain_incontext, chain_table = build_chains(apikey)
|
402 |
+
# Prepare the data
|
403 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
404 |
+
# Get annotation dimensions
|
405 |
+
results = await get_social_concerns_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
406 |
+
# Get warning
|
407 |
+
warnings = get_warnings(results)
|
408 |
+
|
409 |
+
# Build results in the correct format for the Gradio front-end
|
410 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
411 |
+
return results, gr.update(value=pd.DataFrame(warnings,columns=['Warnings:']), visible=True)
|
412 |
+
# Define function to handle the Gradio interface
|
413 |
+
async def composition_only(input_file, apikey):
|
414 |
+
# Build the chains
|
415 |
+
chain_incontext, chain_table = build_chains(apikey)
|
416 |
+
# Prepare the data
|
417 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
418 |
+
# Get annotation dimensions
|
419 |
+
results = await get_composition_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
420 |
+
# Get warning
|
421 |
+
warnings = get_warnings(results)
|
422 |
+
|
423 |
+
# Build results in the correct format for the Gradio front-end
|
424 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
425 |
+
return results, gr.update(value=pd.DataFrame(warnings,columns=['Warnings:']), visible=True)
|
426 |
+
# Define function to handle the Gradio interface
|
427 |
+
async def contributors_only(input_file, apikey):
|
428 |
+
# Build the chains
|
429 |
+
chain_incontext, chain_table = build_chains(apikey)
|
430 |
+
# Prepare the data
|
431 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
432 |
+
# Get annotation dimensions
|
433 |
+
results = await get_contributors_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
434 |
+
# Get warning
|
435 |
+
warnings = get_warnings(results)
|
436 |
+
|
437 |
+
# Build results in the correct format for the Gradio front-end
|
438 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
439 |
+
return results, gr.update(value=pd.DataFrame(warnings,columns=['Warnings:']), visible=True)
|
440 |
+
|
441 |
+
async def gather_only(input_file, apikey):
|
442 |
+
# Build the chains
|
443 |
+
chain_incontext, chain_table = build_chains(apikey)
|
444 |
+
# Prepare the data
|
445 |
+
docsearch = await prepare_data(input_file, chain_table, apikey)
|
446 |
+
# Get annotation dimensions
|
447 |
+
results = await get_gathering_dimension(docsearch,chain_incontext, retrieved_docs=10)
|
448 |
+
# Get warning
|
449 |
+
warnings = get_warnings(results)
|
450 |
+
results = pd.DataFrame(results, columns=['Dimension', 'Results'])
|
451 |
+
return results, gr.update(value=pd.DataFrame(warnings, columns=['Warnings:']), visible=True)
|
452 |
+
|
453 |
+
async def complete(input_file):
|
454 |
+
|
455 |
+
# Build the chains
|
456 |
+
chain_incontext, chain_table = build_chains(apikey=os.getenv("OPEN_AI_API_KEY"))
|
457 |
+
# Prepare the data
|
458 |
+
docsearch = await prepare_data(input_file, chain_table, apikey=os.getenv("OPEN_AI_API_KEY"))
|
459 |
+
#Retrieve dimensions
|
460 |
+
results = await asyncio.gather(get_annotation_dimension(docsearch,chain_incontext, retrieved_docs=10),
|
461 |
+
get_gathering_dimension(docsearch,chain_incontext, retrieved_docs=10),
|
462 |
+
get_uses_dimension(docsearch,chain_incontext, retrieved_docs=10),
|
463 |
+
get_contributors_dimension(docsearch,chain_incontext, retrieved_docs=10),
|
464 |
+
get_composition_dimension(docsearch,chain_incontext, retrieved_docs=10),
|
465 |
+
get_social_concerns_dimension(docsearch,chain_incontext, retrieved_docs=10),
|
466 |
+
get_distribution_dimension(docsearch,chain_incontext, retrieved_docs=10))
|
467 |
+
# Get warning from the results
|
468 |
+
warnings = []
|
469 |
+
for result in results:
|
470 |
+
warnings.append(gr.update(value=[get_warnings(result)], visible=True))
|
471 |
+
#warnings_dt = gr.update(value=pd.DataFrame(warnings,columns=['Warnings:'],labels= None), visible=True)
|
472 |
+
results.extend(warnings)
|
473 |
+
return results
|
474 |
+
|
475 |
+
async def annotation_api_wrapper(input_file, apikey):
|
476 |
+
|
477 |
+
results, alarms = await annotate_only(input_file, apikey)
|
478 |
+
|
479 |
+
response_results = results.to_dict()
|
480 |
+
response_alarms = alarms['value'].to_dict()
|
481 |
+
api_answer = {'results':response_results, 'warnings': response_alarms}
|
482 |
+
return api_answer
|
483 |
+
|
484 |
+
## Building the layout of the app
|
485 |
+
css = """.table-wrap.scroll-hide.svelte-8hrj8a.no-wrap {
|
486 |
+
white-space: normal;
|
487 |
+
}
|
488 |
+
#component-7 .wrap.svelte-xwlu1w {
|
489 |
+
min-height: var(--size-40);
|
490 |
+
}
|
491 |
+
div#component-2 h2 {
|
492 |
+
color: var(--block-label-text-color);
|
493 |
+
text-align: center;
|
494 |
+
border-bottom: 2px solid;
|
495 |
+
border-radius: 7px;
|
496 |
+
text-align: center;
|
497 |
+
margin: 0 15% 0 15%;
|
498 |
+
}
|
499 |
+
div#component-5 {
|
500 |
+
border: 1px solid var(--border-color-primary);
|
501 |
+
border-radius: 0 0px 10px 10px;
|
502 |
+
padding: 20px;
|
503 |
+
}
|
504 |
+
.gradio-container.gradio-container-3-26-0.svelte-ac4rv4.app {
|
505 |
+
max-width: 850px;
|
506 |
+
}
|
507 |
+
div#component-6 {
|
508 |
+
min-height: 150px;
|
509 |
+
}
|
510 |
+
button#component-17 {
|
511 |
+
color: var(--block-label-text-color);
|
512 |
+
}
|
513 |
+
.gradio-container.gradio-container-3-26-0.svelte-ac4rv4.app {
|
514 |
+
max-width: 1100px;
|
515 |
+
}
|
516 |
+
#component-9 .wrap.svelte-xwlu1w {
|
517 |
+
min-height: var(--size-40);
|
518 |
+
}
|
519 |
+
div#component-11 {
|
520 |
+
height: var(--size-40);
|
521 |
+
}
|
522 |
+
div#component-9 {
|
523 |
+
border: 1px solid grey;
|
524 |
+
border-radius: 10px;
|
525 |
+
padding: 3px;
|
526 |
+
text-align: center;
|
527 |
+
}
|
528 |
+
"""
|
529 |
+
|
530 |
+
with gr.Blocks(theme=gr.themes.Soft(), css=css) as demo:
|
531 |
+
with gr.Row():
|
532 |
+
gr.Markdown("## Dataset documentation analyzer")
|
533 |
+
with gr.Row():
|
534 |
+
gr.Markdown("""Extract, in a structured manner, the **[general guidelines](https://knowingmachines.org/reading-list#dataset_documentation_practices)** from the ML community about dataset documentation practices from its scientific documentation. Study and analyze scientific data published in peer-review journals such as: **[Nature's Scientific Data](https://duckduckgo.com)** and **[Data-in-Brief](https://duckduckgo.com)**. Here you have a **[complete list](https://zenodo.org/record/7082126#.ZDaf-OxBz0p)** of data journals suitable to be analyzed with this tool.
|
535 |
+
""")
|
536 |
+
|
537 |
+
with gr.Row():
|
538 |
+
|
539 |
+
with gr.Column():
|
540 |
+
fileinput = gr.File(label="Upload TXT file"),
|
541 |
+
|
542 |
+
with gr.Column():
|
543 |
+
gr.Markdown(""" <h4 style=text-align:center>Instructions: </h4>
|
544 |
+
|
545 |
+
<b> ⤵ Try the examples </b> at the bottom
|
546 |
+
|
547 |
+
<b> ⇨ Set your API KEY </b> of OpenAI
|
548 |
+
|
549 |
+
<b> ⇦ Upload </b> your data paper (in PDF or TXT)
|
550 |
+
|
551 |
+
<b> ⇩ Click in get insights </b> in one tab!
|
552 |
+
|
553 |
+
""")
|
554 |
+
with gr.Column():
|
555 |
+
apikey_elem = gr.Text(label="Your OpenAI APIKey")
|
556 |
+
# gr.Markdown("""
|
557 |
+
# <h3> Improving your data and assesing your dataset documentation </h3>
|
558 |
+
# The generated warning also allows you quicly check the completeness of the documentation, and spotting gaps in the document
|
559 |
+
# <h3> Performing studies studies over scientific data </h3>
|
560 |
+
# If you need to analyze a large scale of documents, we provide an <strong>API</strong> that can be used programatically. Documentation on how to use it is at the bottom of the page. """)
|
561 |
+
with gr.Row():
|
562 |
+
with gr.Tab("Annotation"):
|
563 |
+
|
564 |
+
gr.Markdown("""In this chapter, we get information regarding the annotation process of the data: We provide a description of the process and we infer its type from the documentation. Then we extract the labels, and information about the annotation team, the infrastructure used to annotate the data and the validation process applied over the labels""")
|
565 |
+
result_anot = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
566 |
+
alerts_anot = gr.DataFrame(headers=["warnings"],type="array", visible=False)
|
567 |
+
button_annotation = gr.Button("Get the annotation process insights!")
|
568 |
+
|
569 |
+
with gr.Tab("Gathering"):
|
570 |
+
gr.Markdown("""In this chapter, we get information regarding the collection process of the data: We provide a description of the process and we infer its type from the documentation. Then we extract information about the collection team, the infrastructure used to collect the data and the sources. Also we get the timeframe of the data collection and its geolocalization.""")
|
571 |
+
result_gather = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
572 |
+
alerts_gather = gr.DataFrame(headers=["warnings"],type="array", visible=False)
|
573 |
+
button_gathering = gr.Button("Get the gathering process insights!")
|
574 |
+
with gr.Tab("Uses"):
|
575 |
+
gr.Markdown("""In this chapter, we extract the design intentios of the authors, we extract the purposes, gaps, and we infer the ML tasks (extracted form hugginface) the dataset is inteded for. Also we get the uses recomendation and the ML Benchmarks if the dataset have been tested with them""")
|
576 |
+
result_uses = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
577 |
+
alerts_uses = gr.DataFrame(headers=["warnings"],type="array", visible=False)
|
578 |
+
button_uses = gr.Button("Get the uses of the dataset!")
|
579 |
+
with gr.Tab("Contributors"):
|
580 |
+
gr.Markdown("""In this chapter, we extract all the contributors, funding information and maintenance of the dataset""")
|
581 |
+
result_contrib = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
582 |
+
alerts_contrib = gr.DataFrame(headers=["warnings"],type="array", visible=False)
|
583 |
+
button_contrib = gr.Button("Get the contributors of the dataset!")
|
584 |
+
|
585 |
+
with gr.Tab("Composition"):
|
586 |
+
gr.Markdown("""In this chapter, we extract the file structure, we identify the attributes of the dataset, the recommneded trainig splits and the relevant statistics (if provided in the documentation) """)
|
587 |
+
result_comp = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
588 |
+
alerts_comp = gr.DataFrame(headers=["warnings"],type="array", visible=False)
|
589 |
+
button_comp = gr.Button("Get the composition of the dataset!")
|
590 |
+
with gr.Tab("Social Concerns"):
|
591 |
+
gr.Markdown("""In this chapter, we extract social concerns regarding the representativeness of social groups, potential biases, sensitivity issues, and privacy issues. """)
|
592 |
+
result_social = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
593 |
+
alerts_social = gr.DataFrame(headers=["warnings"],type="array", visible=False)
|
594 |
+
button_social = gr.Button("Get the Social Cocerns!")
|
595 |
+
|
596 |
+
with gr.Tab("Distribution"):
|
597 |
+
gr.Markdown("""In this chapter, we aim to extract the legal conditions under the dataset is released) """)
|
598 |
+
result_distri = gr.DataFrame(headers=["dimension","result"],type="array",label="Results of the extraction:")
|
599 |
+
alerts_distribution = gr.DataFrame(headers=["warning"],type="array", visible=False)
|
600 |
+
button_dist = gr.Button("Get the Distribution!")
|
601 |
+
with gr.Row():
|
602 |
+
examples = gr.Examples(
|
603 |
+
examples=["sources/Nature-Scientific-Data/A whole-body FDG-PET:CT.pdf","sources/Nature-Scientific-Data/Lontar-Manuscripts.pdf"],
|
604 |
+
inputs=[fileinput[0]],
|
605 |
+
fn=complete,
|
606 |
+
outputs=[
|
607 |
+
result_anot,
|
608 |
+
result_gather,
|
609 |
+
result_uses,
|
610 |
+
result_contrib,
|
611 |
+
result_comp,
|
612 |
+
result_social,
|
613 |
+
result_distri,
|
614 |
+
alerts_anot,
|
615 |
+
alerts_gather,
|
616 |
+
alerts_uses,
|
617 |
+
alerts_contrib,
|
618 |
+
alerts_comp,
|
619 |
+
alerts_social,
|
620 |
+
alerts_distribution],
|
621 |
+
cache_examples=True)
|
622 |
+
button_complete = gr.Button("Get all the dimensions", visible=False)
|
623 |
+
allres = gr.Text(visible=False)
|
624 |
+
## Events of the apps
|
625 |
+
button_annotation.click(annotate_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_anot,alerts_anot])
|
626 |
+
button_gathering.click(gather_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_gather,alerts_gather])
|
627 |
+
button_uses.click(uses_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_uses,alerts_uses])
|
628 |
+
button_contrib.click(contributors_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_contrib,alerts_contrib])
|
629 |
+
button_comp.click(composition_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_comp,alerts_comp])
|
630 |
+
button_social.click(social_cocerns_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_social,alerts_social])
|
631 |
+
button_dist.click(distribution_only,inputs=[fileinput[0],apikey_elem ],outputs=[result_distri,alerts_distribution])
|
632 |
+
|
633 |
+
|
634 |
+
## API endpoints
|
635 |
+
button_complete.click(annotation_api_wrapper,inputs=[fileinput[0],apikey_elem],outputs=allres, api_name="our")
|
636 |
+
|
637 |
+
|
638 |
+
# Run the app
|
639 |
+
#demo.queue(concurrency_count=5,max_size=20).launch()
|
640 |
+
demo.launch(share=True,auth=("CKIM2023", "demodemo"))
|
641 |
+
|
packages.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
default-jre
|
requirements.txt
ADDED
@@ -0,0 +1,317 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
absl-py==1.3.0
|
2 |
+
accelerate==0.19.0
|
3 |
+
aiofiles==23.1.0
|
4 |
+
aiohttp==3.8.4
|
5 |
+
aiosignal==1.3.1
|
6 |
+
alembic==1.8.1
|
7 |
+
altair==5.0.0
|
8 |
+
anyio==3.6.2
|
9 |
+
appdirs==1.4.4
|
10 |
+
appnope==0.1.3
|
11 |
+
asttokens==2.1.0
|
12 |
+
astunparse==1.6.3
|
13 |
+
async-timeout==4.0.2
|
14 |
+
attrs==23.1.0
|
15 |
+
azure-ai-formrecognizer==3.2.0
|
16 |
+
azure-common==1.1.28
|
17 |
+
azure-core==1.26.1
|
18 |
+
backcall==0.2.0
|
19 |
+
backoff==2.2.1
|
20 |
+
beautifulsoup4==4.11.1
|
21 |
+
bitsandbytes==0.39.0
|
22 |
+
blis==0.7.9
|
23 |
+
blobfile==2.0.0
|
24 |
+
cachetools==5.2.0
|
25 |
+
camelot-py==0.9.0
|
26 |
+
catalogue==2.0.8
|
27 |
+
certifi==2023.5.7
|
28 |
+
cffi==1.15.1
|
29 |
+
chardet==5.1.0
|
30 |
+
charset-normalizer==3.1.0
|
31 |
+
click==8.1.3
|
32 |
+
cloudpickle==2.2.0
|
33 |
+
cohere==4.1.3
|
34 |
+
confection==0.0.4
|
35 |
+
construct==2.5.3
|
36 |
+
contourpy==1.0.7
|
37 |
+
cryptography==40.0.2
|
38 |
+
cycler==0.11.0
|
39 |
+
cymem==2.0.7
|
40 |
+
databricks-cli==0.17.3
|
41 |
+
dataclasses-json==0.5.7
|
42 |
+
datasets==2.7.1
|
43 |
+
debugpy==1.6.3
|
44 |
+
decorator==5.1.1
|
45 |
+
dill==0.3.6
|
46 |
+
Distance==0.1.3
|
47 |
+
distlib==0.3.6
|
48 |
+
distro==1.8.0
|
49 |
+
docker==6.0.1
|
50 |
+
docopt==0.6.2
|
51 |
+
elasticsearch==7.17.7
|
52 |
+
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0-py3-none-any.whl
|
53 |
+
entrypoints==0.4
|
54 |
+
et-xmlfile==1.1.0
|
55 |
+
executing==1.2.0
|
56 |
+
extruct==0.14.0
|
57 |
+
faiss-cpu==1.7.2
|
58 |
+
farm-haystack==1.12.2
|
59 |
+
fastapi==0.95.2
|
60 |
+
fastjsonschema==2.16.2
|
61 |
+
ffmpy==0.3.0
|
62 |
+
filelock==3.12.0
|
63 |
+
Flask==2.2.2
|
64 |
+
flatbuffers==22.10.26
|
65 |
+
fonttools==4.39.4
|
66 |
+
frozenlist==1.3.3
|
67 |
+
fsspec==2023.5.0
|
68 |
+
future==0.18.2
|
69 |
+
gast==0.4.0
|
70 |
+
gitdb==4.0.9
|
71 |
+
GitPython==3.1.29
|
72 |
+
google-auth==2.14.1
|
73 |
+
google-auth-oauthlib==0.4.6
|
74 |
+
google-pasta==0.2.0
|
75 |
+
gpt-index==0.5.12
|
76 |
+
gradio==3.26.0
|
77 |
+
gradio_client==0.1.2
|
78 |
+
grobid-client-python==0.0.5
|
79 |
+
grpcio==1.50.0
|
80 |
+
gunicorn==20.1.0
|
81 |
+
h11==0.14.0
|
82 |
+
h5py==3.7.0
|
83 |
+
haystack==0.42
|
84 |
+
html-text==0.5.2
|
85 |
+
html5lib==1.1
|
86 |
+
htmlmin==0.1.12
|
87 |
+
httpcore==0.17.1
|
88 |
+
httpx==0.24.1
|
89 |
+
huggingface-hub==0.14.1
|
90 |
+
idna==3.4
|
91 |
+
ImageHash==4.3.1
|
92 |
+
importlib-metadata==5.0.0
|
93 |
+
inflect==6.0.2
|
94 |
+
iniconfig==1.1.1
|
95 |
+
ipykernel==6.17.1
|
96 |
+
ipython==8.6.0
|
97 |
+
ipywidgets==8.0.2
|
98 |
+
isodate==0.6.1
|
99 |
+
itsdangerous==2.1.2
|
100 |
+
jaconv==0.3
|
101 |
+
jamo==0.4.1
|
102 |
+
jarowinkler==1.2.3
|
103 |
+
jedi==0.18.1
|
104 |
+
Jinja2==3.1.2
|
105 |
+
joblib==1.2.0
|
106 |
+
jsonschema==4.17.3
|
107 |
+
jstyleson==0.0.2
|
108 |
+
jupyter_client==7.4.7
|
109 |
+
jupyter_core==5.0.0
|
110 |
+
jupyterlab-widgets==3.0.3
|
111 |
+
keras==2.10.0
|
112 |
+
Keras-Preprocessing==1.1.2
|
113 |
+
kiwisolver==1.4.4
|
114 |
+
langchain==0.0.173
|
115 |
+
langcodes==3.3.0
|
116 |
+
langdetect==1.0.9
|
117 |
+
libclang==14.0.6
|
118 |
+
linkify-it-py==2.0.2
|
119 |
+
llvmlite==0.39.1
|
120 |
+
loralib==0.1.1
|
121 |
+
lxml==4.9.1
|
122 |
+
Mako==1.2.4
|
123 |
+
Markdown==3.4.1
|
124 |
+
markdown-it-py==2.2.0
|
125 |
+
markdown2==2.4.6
|
126 |
+
MarkupSafe==2.1.2
|
127 |
+
marshmallow==3.19.0
|
128 |
+
marshmallow-enum==1.5.1
|
129 |
+
matplotlib==3.7.1
|
130 |
+
matplotlib-inline==0.1.6
|
131 |
+
mdit-py-plugins==0.3.3
|
132 |
+
mdurl==0.1.2
|
133 |
+
mf2py==1.1.2
|
134 |
+
mistune==2.0.4
|
135 |
+
mlflow==2.0.1
|
136 |
+
mmh3==3.0.0
|
137 |
+
monotonic==1.6
|
138 |
+
more-itertools==9.0.0
|
139 |
+
mpmath==1.2.1
|
140 |
+
msgpack==1.0.4
|
141 |
+
msrest==0.7.1
|
142 |
+
multidict==6.0.4
|
143 |
+
multimethod==1.9
|
144 |
+
multiprocess==0.70.14
|
145 |
+
murmurhash==1.0.9
|
146 |
+
mypy-extensions==0.4.3
|
147 |
+
nest-asyncio==1.5.6
|
148 |
+
networkx==2.8.8
|
149 |
+
nltk==3.7
|
150 |
+
num2words==0.5.12
|
151 |
+
numba==0.56.4
|
152 |
+
numexpr==2.8.4
|
153 |
+
numpy==1.24.3
|
154 |
+
oauthlib==3.2.2
|
155 |
+
openai==0.27.2
|
156 |
+
openapi-schema-pydantic==1.2.4
|
157 |
+
opencv-python==4.7.0.72
|
158 |
+
openpyxl==3.0.10
|
159 |
+
opt-einsum==3.3.0
|
160 |
+
orjson==3.8.12
|
161 |
+
outcome==1.2.0
|
162 |
+
packaging==23.1
|
163 |
+
pandas==2.0.1
|
164 |
+
pandas-profiling==3.6.0
|
165 |
+
pandocfilters==1.5.0
|
166 |
+
parso==0.8.3
|
167 |
+
pathspec==0.10.2
|
168 |
+
pathy==0.10.1
|
169 |
+
patsy==0.5.3
|
170 |
+
pdf2image==1.16.0
|
171 |
+
pdfminer.six==20221105
|
172 |
+
pefile==2022.5.30
|
173 |
+
pexpect==4.8.0
|
174 |
+
phik==0.12.3
|
175 |
+
pickleshare==0.7.5
|
176 |
+
Pillow==9.5.0
|
177 |
+
platformdirs==2.5.4
|
178 |
+
pluggy==1.0.0
|
179 |
+
posthog==2.2.0
|
180 |
+
preshed==3.0.8
|
181 |
+
prompt-toolkit==3.0.32
|
182 |
+
protobuf==3.19.6
|
183 |
+
psutil==5.9.4
|
184 |
+
psycopg2-binary==2.9.5
|
185 |
+
ptyprocess==0.7.0
|
186 |
+
pure-eval==0.2.2
|
187 |
+
py==1.11.0
|
188 |
+
py-cpuinfo==9.0.0
|
189 |
+
pyarrow==10.0.0
|
190 |
+
pyasn1==0.4.8
|
191 |
+
pyasn1-modules==0.2.8
|
192 |
+
pycparser==2.21
|
193 |
+
pycryptodomex==3.16.0
|
194 |
+
pydantic==1.10.7
|
195 |
+
pydub==0.25.1
|
196 |
+
Pygments==2.13.0
|
197 |
+
PyJWT==2.6.0
|
198 |
+
pyparsing==3.0.9
|
199 |
+
PyPDF2==2.12.1
|
200 |
+
pyphen==0.14.0
|
201 |
+
pypinyin==0.44.0
|
202 |
+
pyRdfa3==3.5.3
|
203 |
+
pyrsistent==0.19.3
|
204 |
+
PySocks==1.7.1
|
205 |
+
pytesseract==0.3.10
|
206 |
+
python-dateutil==2.8.2
|
207 |
+
python-docx==0.8.11
|
208 |
+
python-dotenv==0.21.0
|
209 |
+
python-magic==0.4.27
|
210 |
+
python-multipart==0.0.6
|
211 |
+
python-ptrace==0.9.8
|
212 |
+
pytorch-wpe==0.0.1
|
213 |
+
pytrec-eval==0.5
|
214 |
+
pytz==2023.3
|
215 |
+
PyWavelets==1.4.1
|
216 |
+
PyYAML==6.0
|
217 |
+
pyzmq==24.0.1
|
218 |
+
quantulum3==0.7.11
|
219 |
+
querystring-parser==1.2.4
|
220 |
+
rank-bm25==0.2.2
|
221 |
+
rapidfuzz==2.7.0
|
222 |
+
rdflib==6.2.0
|
223 |
+
regex==2022.10.31
|
224 |
+
requests==2.30.0
|
225 |
+
requests-oauthlib==1.3.1
|
226 |
+
responses==0.18.0
|
227 |
+
rsa==4.9
|
228 |
+
safetensors==0.3.1
|
229 |
+
scikit-learn==1.1.3
|
230 |
+
scipdf @ git+https://github.com/titipata/scipdf_parser@501cf2547320adca78a94e2b2ba83526e46bd82e
|
231 |
+
scipy==1.9.3
|
232 |
+
seaborn==0.12.1
|
233 |
+
semantic-version==2.10.0
|
234 |
+
sentence-transformers==2.2.2
|
235 |
+
sentencepiece==0.1.97
|
236 |
+
seqeval==1.2.2
|
237 |
+
shap==0.41.0
|
238 |
+
six==1.16.0
|
239 |
+
slicer==0.0.7
|
240 |
+
smart-open==6.3.0
|
241 |
+
smmap==5.0.0
|
242 |
+
sniffio==1.3.0
|
243 |
+
sortedcontainers==2.4.0
|
244 |
+
soupsieve==2.3.2.post1
|
245 |
+
spacy==3.5.3
|
246 |
+
spacy-legacy==3.0.12
|
247 |
+
spacy-loggers==1.0.4
|
248 |
+
SQLAlchemy==1.4.44
|
249 |
+
SQLAlchemy-Utils==0.38.3
|
250 |
+
sqlparse==0.4.3
|
251 |
+
srsly==2.4.6
|
252 |
+
stack-data==0.6.1
|
253 |
+
starlette==0.27.0
|
254 |
+
statsmodels==0.13.5
|
255 |
+
sympy==1.11.1
|
256 |
+
tabula-py==2.7.0
|
257 |
+
tabulate==0.9.0
|
258 |
+
tangled-up-in-unicode==0.2.0
|
259 |
+
tenacity==8.2.2
|
260 |
+
tensorboard==2.10.1
|
261 |
+
tensorboard-data-server==0.6.1
|
262 |
+
tensorboard-plugin-wit==1.8.1
|
263 |
+
tensorflow-estimator==2.10.0
|
264 |
+
tensorflow-macos==2.10.0
|
265 |
+
tensorflow-metal==0.6.0
|
266 |
+
termcolor==2.1.0
|
267 |
+
textstat==0.7.3
|
268 |
+
thinc==8.1.10
|
269 |
+
threadpoolctl==3.1.0
|
270 |
+
tika==1.24
|
271 |
+
tiktoken==0.4.0
|
272 |
+
tinycss2==1.2.1
|
273 |
+
tk==0.1.0
|
274 |
+
tokenize-rt==5.0.0
|
275 |
+
tokenizers==0.12.1
|
276 |
+
toml==0.10.2
|
277 |
+
tomli==2.0.1
|
278 |
+
tomli_w==1.0.0
|
279 |
+
tomlkit==0.11.6
|
280 |
+
toolz==0.12.0
|
281 |
+
torch==1.12.1
|
282 |
+
torch-complex==0.4.3
|
283 |
+
torchvision==0.14.0
|
284 |
+
tornado==6.2
|
285 |
+
tqdm==4.65.0
|
286 |
+
traitlets==5.5.0
|
287 |
+
transformers @ git+https://github.com/huggingface/transformers@4b6a5a7caa1ea31a3321eb17e6dcc9baff4f55d9
|
288 |
+
typeguard==2.13.3
|
289 |
+
typer==0.7.0
|
290 |
+
typing-inspect==0.8.0
|
291 |
+
typing_extensions==4.5.0
|
292 |
+
tzdata==2023.3
|
293 |
+
uc-micro-py==1.0.2
|
294 |
+
ujson==5.1.0
|
295 |
+
Unidecode==1.3.6
|
296 |
+
url-normalize==1.4.3
|
297 |
+
urllib3==2.0.2
|
298 |
+
uvicorn==0.22.0
|
299 |
+
validators==0.18.2
|
300 |
+
virtualenv==20.16.7
|
301 |
+
visions==0.7.5
|
302 |
+
w3lib==2.1.1
|
303 |
+
wasabi==1.1.1
|
304 |
+
watchdog==2.1.9
|
305 |
+
wcwidth==0.2.5
|
306 |
+
webencodings==0.5.1
|
307 |
+
websocket-client==1.4.2
|
308 |
+
websockets==11.0.3
|
309 |
+
Werkzeug==2.2.2
|
310 |
+
widgetsnbextension==4.0.3
|
311 |
+
wrapt==1.14.1
|
312 |
+
xlwt==1.3.0
|
313 |
+
xmltodict==0.13.0
|
314 |
+
xxhash==3.1.0
|
315 |
+
yapf==0.32.0
|
316 |
+
yarl==1.9.2
|
317 |
+
zipp==3.10.0
|