MCPcopy Create free account
hub / github.com/ScienciaLAB/document-qa / init_ner

Function init_ner

streamlit_app.py:162–191  ·  view source on GitHub ↗

Initialise the NER aggregation processor (quantities + materials). Uses ``GROBID_QUANTITIES_URL`` and ``GROBID_MATERIALS_URL`` from the environment. Results are cached across Streamlit reruns. Returns: GrobidAggregationProcessor: Configured processor instance.

()

Source from the content-addressed store, hash-verified

160
161@st.cache_resource
162def init_ner():
163 """Initialise the NER aggregation processor (quantities + materials).
164
165 Uses ``GROBID_QUANTITIES_URL`` and ``GROBID_MATERIALS_URL`` from
166 the environment. Results are cached across Streamlit reruns.
167
168 Returns:
169 GrobidAggregationProcessor: Configured processor instance.
170 """
171 quantities_client = QuantitiesAPI(os.environ["GROBID_QUANTITIES_URL"], check_server=True)
172
173 materials_client = NERClientGeneric(ping=True)
174 config_materials = {
175 "grobid": {
176 "server": os.environ["GROBID_MATERIALS_URL"],
177 "sleep_time": 5,
178 "timeout": 60,
179 "url_mapping": {
180 "processText_disable_linking": "/service/process/text?disableLinking=True",
181 # 'processText_disable_linking': "/service/process/text"
182 },
183 }
184 }
185
186 materials_client.set_config(config_materials)
187
188 gqa = GrobidAggregationProcessor(
189 grobid_quantities_client=quantities_client, grobid_superconductors_client=materials_client
190 )
191 return gqa
192
193
194gqa = init_ner()

Callers 1

streamlit_app.pyFile · 0.85

Calls 3

set_configMethod · 0.95
NERClientGenericClass · 0.90

Tested by

no test coverage detected