Closed alphaprojects1 closed 2 years ago
Did you add the library to requirements.txt and use a remote build? Here's a patch to install fastapi
for the function.
As to the 413
payload error, it could be due to the size of the function zip file after bundling both the library and the model exceeds the current limit of 48MB
. A workaround would be to store the model in Spaces and download it into the function directly.
diff --git a/packages/joke/joke/__main__.py b/packages/joke/joke/__main__.py
index 88a16b2..ed3adab 100644
--- a/packages/joke/joke/__main__.py
+++ b/packages/joke/joke/__main__.py
@@ -1,10 +1,10 @@
-import pyjokes
+import pickle
+from fastapi import FastAPI
def main(args):
- joke = pyjokes.get_joke()
return {
'body': {
'response_type': 'in_channel',
- 'text': joke
+ 'text': '???'
}
}
diff --git a/packages/joke/joke/requirements.txt b/packages/joke/joke/requirements.txt
index 846fd67..1e77ba6 100644
--- a/packages/joke/joke/requirements.txt
+++ b/packages/joke/joke/requirements.txt
@@ -1 +1 @@
-pyjokes==0.6.0
+fastapi==0.78.0
We are having problems using functions for the purpose of deploying a machine learning API.
In particular we have two issues:
Reduced code (to minimum) for illustration:
results in error (for fastapi):
and separately we get error for file:
Can you help us on both questions, i.e. when/where to install python modules, why do we get error on file size even though it is only 0.3GB.