Spaces:
Sleeping
Sleeping
Lamp Socrates
commited on
Commit
•
5c82e3e
1
Parent(s):
c89a5c0
api access
Browse files
app.py
CHANGED
@@ -138,6 +138,12 @@ def render_random_examples():
|
|
138 |
|
139 |
# Display the table
|
140 |
st.table(st.session_state['random_examples'])
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
def prep_page():
|
143 |
model = load_trained_model()
|
@@ -198,5 +204,12 @@ def prep_page():
|
|
198 |
|
199 |
|
200 |
if __name__ == '__main__':
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
# Display the table
|
140 |
st.table(st.session_state['random_examples'])
|
141 |
+
def predict_using_trained(sentence):
|
142 |
+
model = load_trained_model()
|
143 |
+
|
144 |
+
entities = model(sentence)
|
145 |
+
|
146 |
+
return entities
|
147 |
|
148 |
def prep_page():
|
149 |
model = load_trained_model()
|
|
|
204 |
|
205 |
|
206 |
if __name__ == '__main__':
|
207 |
+
|
208 |
+
query_params = st.query_params
|
209 |
+
if 'api' in query_params:
|
210 |
+
sentence = query_params.get('sentence')
|
211 |
+
entities = predict_using_trained(sentence)
|
212 |
+
st.write({"sentence" : sentence , "entities" : entities})
|
213 |
+
else:
|
214 |
+
prep_page()
|
215 |
+
|