Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -254,22 +254,34 @@ def validation(user_input):
|
|
| 254 |
return "invalid"
|
| 255 |
|
| 256 |
|
| 257 |
-
|
| 258 |
-
fn=
|
| 259 |
-
inputs=
|
| 260 |
-
|
| 261 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
examples=[
|
| 263 |
["AI"],
|
| 264 |
-
["
|
| 265 |
["Rocket Science"]
|
| 266 |
],
|
| 267 |
title="Sprinkler Article Generator API",
|
| 268 |
-
description="
|
| 269 |
-
article="© ScholarSync 2023"
|
| 270 |
)
|
| 271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
|
|
|
| 254 |
return "invalid"
|
| 255 |
|
| 256 |
|
| 257 |
+
validation_interface = gradio.Interface(
|
| 258 |
+
fn=validation,
|
| 259 |
+
inputs=gradio.inputs.Textbox(lines=1, placeholder="Enter your input"),
|
| 260 |
+
outputs=gradio.outputs.Textbox(label="Validation Result"),
|
| 261 |
+
title="Validation API",
|
| 262 |
+
description="API to validate user input"
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
links_interface = gradio.Interface(
|
| 266 |
+
fn=get_links,
|
| 267 |
+
inputs=gradio.inputs.Textbox(lines=1, placeholder="Enter your input"),
|
| 268 |
+
outputs=gradio.outputs.JSON(),
|
| 269 |
examples=[
|
| 270 |
["AI"],
|
| 271 |
+
["Biochemicals"],
|
| 272 |
["Rocket Science"]
|
| 273 |
],
|
| 274 |
title="Sprinkler Article Generator API",
|
| 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 to validate input and generate article recommendations"
|
| 283 |
+
)
|
| 284 |
|
| 285 |
+
# Run the app
|
| 286 |
+
if __name__ == "__main__":
|
| 287 |
+
app.launch()
|