From f815966b9a493dab4def10af77176fb3d2935878 Mon Sep 17 00:00:00 2001 From: Mogith PN Date: Tue, 19 Dec 2023 13:48:27 +0530 Subject: [PATCH] modified clarifai version --- pages/first_page.py | 9 ++++++--- requirements.txt | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pages/first_page.py b/pages/first_page.py index 4e04312..102bc32 100644 --- a/pages/first_page.py +++ b/pages/first_page.py @@ -29,10 +29,10 @@ # Stream inputs from the app. list_inputs give list of dictionaries with inputs and its metadata . input_obj = User(user_id=userDataObject.user_id).app(app_id=userDataObject.app_id).inputs() - all_inputs = input_obj.list_inputs() + all_inputs = list(input_obj.list_inputs()) #Check for no of inputs in the app and compare it with no of inputs to be displayed. - if len(all_inputs) < (mtotal): + if len((all_inputs)) < (mtotal): raise Exception( f"No of inputs is less than {mtotal}. Please add more inputs or reduce the inputs to be displayed !" ) @@ -41,9 +41,12 @@ data = [] #added "data_url" which gives the url of the input. for inp in range(mtotal): + data_url = all_inputs[inp].data.image.url + if len(data_url) < 1: + data_url= all_inputs[inp].data.text.url data.append({ "id": all_inputs[inp].id, - "data_url": all_inputs[inp].data.image.url, + "data_url": data_url, "status": all_inputs[inp].status.description, "created_at": timestamp_pb2.Timestamp.ToDatetime(all_inputs[inp].created_at), "modified_at": timestamp_pb2.Timestamp.ToDatetime(all_inputs[inp].modified_at), diff --git a/requirements.txt b/requirements.txt index 5b4670f..a04f14c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -clarifai==9.8.1 +clarifai==9.11.0 streamlit==1.24.0