forked from runpod/runpod-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfer.py
More file actions
45 lines (35 loc) · 942 Bytes
/
infer.py
File metadata and controls
45 lines (35 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'''
Template for the infer.py file.
Input -> model parameters
Output -> list of files
'''
# pylint: disable=unused-argument,too-few-public-methods
import runpod
def validator():
'''
Optional validator function.
Lists the expected inputs of the model, and their types.
If there are any conflicts the job request is errored out.
'''
return {
'prompt': {
'type': str,
'required': True
}
}
def run(model_inputs):
'''
Predicts the output of the model.
Returns output path, with the seed used to generate the image.
If errors are encountered, return a dictionary with the key "error".
The error can be a string or list of strings.
'''
# Return Errors
# return {"error": "Error Message"}
return [
{
"image": "/path/to/image.png",
"seed": "1234"
}
]
runpod.serverless.start({"handler": run})