Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -112,7 +112,8 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
112 |
print("->Input size:",len(input_batch))
|
113 |
print("+",input_batch)
|
114 |
if isurl:
|
115 |
-
for
|
|
|
116 |
if use_archive:
|
117 |
archive = is_in_archive(url)
|
118 |
if archive['archived']:
|
@@ -121,7 +122,10 @@ def inference(input_batch,isurl,use_archive,limit_companies=10):
|
|
121 |
extracted = Extractor().extract(requests.get(url).text)
|
122 |
input_batch_content.append(extracted['content'])
|
123 |
else:
|
124 |
-
|
|
|
|
|
|
|
125 |
|
126 |
prob_outs = _inference_classifier(input_batch_content)
|
127 |
#sentiment = _inference_sentiment_model_via_api_query({"inputs": extracted['content']})
|
@@ -145,15 +149,15 @@ API input parameters:
|
|
145 |
- `limit_companies`: integer. Number of found relevant companies to report.
|
146 |
|
147 |
"""
|
148 |
-
examples = [[['https://www.bbc.com/news/uk-62732447',
|
149 |
-
'https://www.bbc.com/news/business-62747401',
|
150 |
-
'https://www.bbc.com/news/technology-62744858',
|
151 |
-
'https://www.bbc.com/news/science-environment-62758811',
|
152 |
-
'https://www.theguardian.com/business/2022/sep/02/nord-stream-1-gazprom-announces-indefinite-shutdown-of-pipeline',
|
153 |
-
'https://www.bbc.com/news/world-europe-62766867',
|
154 |
-
'https://www.bbc.com/news/business-62524031',
|
155 |
-
'https://www.bbc.com/news/business-62728621',
|
156 |
-
'https://www.bbc.com/news/science-environment-62680423'],'url',False,5]]
|
157 |
demo = gr.Interface(fn=inference,
|
158 |
inputs=[gr.Dataframe(label='input batch', col_count=1, datatype='str', type='array', wrap=True),
|
159 |
gr.Dropdown(label='data type', choices=['text','url'], type='index'),
|
|
|
112 |
print("->Input size:",len(input_batch))
|
113 |
print("+",input_batch)
|
114 |
if isurl:
|
115 |
+
for row_in in input_batch:
|
116 |
+
url = row_in[0]
|
117 |
if use_archive:
|
118 |
archive = is_in_archive(url)
|
119 |
if archive['archived']:
|
|
|
122 |
extracted = Extractor().extract(requests.get(url).text)
|
123 |
input_batch_content.append(extracted['content'])
|
124 |
else:
|
125 |
+
for row_in in input_batch:
|
126 |
+
input_batch_content.append(row_in[0])
|
127 |
+
print("->Batch size:",len(input_batch_content))
|
128 |
+
print("+",input_batch_content)
|
129 |
|
130 |
prob_outs = _inference_classifier(input_batch_content)
|
131 |
#sentiment = _inference_sentiment_model_via_api_query({"inputs": extracted['content']})
|
|
|
149 |
- `limit_companies`: integer. Number of found relevant companies to report.
|
150 |
|
151 |
"""
|
152 |
+
examples = [[[['https://www.bbc.com/news/uk-62732447'],
|
153 |
+
['https://www.bbc.com/news/business-62747401'],
|
154 |
+
['https://www.bbc.com/news/technology-62744858'],
|
155 |
+
['https://www.bbc.com/news/science-environment-62758811'],
|
156 |
+
['https://www.theguardian.com/business/2022/sep/02/nord-stream-1-gazprom-announces-indefinite-shutdown-of-pipeline'],
|
157 |
+
['https://www.bbc.com/news/world-europe-62766867'],
|
158 |
+
['https://www.bbc.com/news/business-62524031'],
|
159 |
+
['https://www.bbc.com/news/business-62728621'],
|
160 |
+
['https://www.bbc.com/news/science-environment-62680423']],'url',False,5]]
|
161 |
demo = gr.Interface(fn=inference,
|
162 |
inputs=[gr.Dataframe(label='input batch', col_count=1, datatype='str', type='array', wrap=True),
|
163 |
gr.Dropdown(label='data type', choices=['text','url'], type='index'),
|