Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
@@ -230,8 +230,6 @@ def get_article_recommendations(user_input):
|
|
230 |
|
231 |
|
232 |
def get_links(user_input):
|
233 |
-
if(validation(user_input)=="invalid"):
|
234 |
-
return "invalid"
|
235 |
recommendations = get_article_recommendations(user_input)
|
236 |
links = []
|
237 |
for article in recommendations:
|
@@ -256,30 +254,32 @@ def validation(user_input):
|
|
256 |
|
257 |
validation_interface = gradio.Interface(
|
258 |
fn=validation,
|
259 |
-
inputs=
|
260 |
-
outputs=gradio.outputs.
|
261 |
title="Validation API",
|
262 |
description="API to validate user input"
|
263 |
)
|
264 |
|
|
|
265 |
links_interface = gradio.Interface(
|
266 |
fn=get_links,
|
267 |
-
inputs=
|
268 |
outputs=gradio.outputs.JSON(),
|
269 |
examples=[
|
270 |
["AI"],
|
271 |
["Biochemicals"],
|
272 |
["Rocket Science"]
|
273 |
],
|
274 |
-
title="
|
275 |
description="API to generate article recommendations based on user input"
|
276 |
)
|
277 |
|
278 |
# Combine interfaces into a single app
|
279 |
app = gradio.Interface(
|
280 |
[validation_interface, links_interface],
|
281 |
-
title="Sprinkler API",
|
282 |
-
description="API
|
|
|
283 |
)
|
284 |
|
285 |
# Run the app
|
|
|
230 |
|
231 |
|
232 |
def get_links(user_input):
|
|
|
|
|
233 |
recommendations = get_article_recommendations(user_input)
|
234 |
links = []
|
235 |
for article in recommendations:
|
|
|
254 |
|
255 |
validation_interface = gradio.Interface(
|
256 |
fn=validation,
|
257 |
+
inputs="text",
|
258 |
+
outputs=gradio.outputs.JSON(),
|
259 |
title="Validation API",
|
260 |
description="API to validate user input"
|
261 |
)
|
262 |
|
263 |
+
|
264 |
links_interface = gradio.Interface(
|
265 |
fn=get_links,
|
266 |
+
inputs="text",
|
267 |
outputs=gradio.outputs.JSON(),
|
268 |
examples=[
|
269 |
["AI"],
|
270 |
["Biochemicals"],
|
271 |
["Rocket Science"]
|
272 |
],
|
273 |
+
title="Article Links Generator API",
|
274 |
description="API to generate article recommendations based on user input"
|
275 |
)
|
276 |
|
277 |
# Combine interfaces into a single app
|
278 |
app = gradio.Interface(
|
279 |
[validation_interface, links_interface],
|
280 |
+
title="Sprinkler Article Generator API",
|
281 |
+
description="This is a AI powered REST API with Gradio and Huggingface Spaces – for free! Based on [this article](https://www.tomsoderlund.com/ai/building-ai-powered-rest-api). See the **Use via API** link at the bottom of this page.",
|
282 |
+
article="© ScholarSync 2023"
|
283 |
)
|
284 |
|
285 |
# Run the app
|