Sai004 commited on
Commit
a29fe00
·
1 Parent(s): ad7b470

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -11
app.py CHANGED
@@ -254,22 +254,34 @@ def validation(user_input):
254
  return "invalid"
255
 
256
 
257
- gradio_interface = gradio.Interface(
258
- fn=[get_links,validation],
259
- inputs=[ gradio.inputs.Textbox(label="get links"),
260
- gradio.inputs.Textbox(label="validation")],
261
- outputs=[ gradio.outputs.JSON(),gradio.outputs.JSON()],
 
 
 
 
 
 
 
262
  examples=[
263
  ["AI"],
264
- ["Sai sahoo"],
265
  ["Rocket Science"]
266
  ],
267
  title="Sprinkler Article Generator API",
268
- 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.",
269
- article="© ScholarSync 2023"
270
  )
271
 
 
 
 
 
 
 
272
 
273
- gradio_interface.launch()
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()