import gradio as gr import ast import requests #Using Gradio Demos as API - This is Hot! API_URL_INITIAL = "https://ysharma-playground-ai-exploration.hf.space/run/initial_dataframe" API_URL_NEXT10 = "https://ysharma-playground-ai-exploration.hf.space/run/next_10_rows" #define inference function #First: Get initial images for the grid display def get_initial_images(): response = requests.post(API_URL_INITIAL, json={ "data": [] }).json() #data = response["data"][0]['data'][0][0][:-1] response_dict = response['data'][0] return response_dict #, [resp[0][:-1] for resp in response["data"][0]["data"]] #Second: Process response dictionary to get imges as hyperlinked image tags def process_response(response_dict): return [resp[0][:-1] for resp in response_dict["data"]] response_dict = get_initial_images() initial = process_response(response_dict) initial_imgs = '
▶️Do you see the "view api" link located in the footer of this application?
By clicking on this link, a page will open which provides documentation on the REST API that developers can use to query the Interface function / Block events.
▶️In this demo, I am making such an API request to the