MCPcopy Create free account
hub / github.com/diffgram/diffgram / Process_Media

Class Process_Media

walrus/methods/input/process_media.py:75–2363  ·  view source on GitHub ↗

Basic process of using this is to call init with session and: * project or project_id * input or input_id Generally expect * prefer object (ie project), the id option (ie project_id) is for threading * Input class to already be "setup" with useful info before callin

Source from the content-addressed store, hash-verified

73
74
75class Process_Media():
76 """
77 Basic process of using this is to call init with session and:
78 * project or project_id
79 * input or input_id
80
81 Generally expect
82 * prefer object (ie project), the id option (ie project_id) is for threading
83 * Input class to already be "setup" with useful info before calling this
84 * That the file is "available" either in memory as a numpy array
85 or in a temporary directory. if the file is from a url
86 we attempt to download it first.
87
88 Expected call methods
89 * main_entry()
90 * process_one_image_file()
91 * process_url()
92
93 On recursion and threads
94 * we expect main_entry() can be called recursively, for example
95 from process_csv
96 * we can create instances of Process_Media to use with threads
97 or for recursive
98
99 EXAMPLE use:
100
101 process_media = Process_Media(
102 session = session,
103 member = None,
104 input_id = input_id)
105
106 process_media.main_entry()
107
108 (See upload.py)
109
110 main_entry is generally when the file type or method is unknown
111 for example, from the UI where the user can upload many types
112
113 the other methods are meant to be used in conjunction with other classes
114 ie process_one_image_file() for use with video
115 or process_url for use with prediction
116
117 As we progress from just "get the files in there"
118 to "do stuff with the files" and "pull from API / other sources" this
119 class can expand.
120
121 CAUTION
122 input_id is not guaranteed to be available
123 and if Input object is passed of some types (currently == frame),
124 then we do NOT commit it and do not expect
125 input.id to be available either.
126
127 """
128
129 def __init__(self,
130 session,
131 member = None,
132 project: Project = None,

Calls

no outgoing calls

Tested by

no test coverage detected