Spaces error with custom webpage
I have a call that is made using a FastAPI site that I built. I’m calling a “def generate_response” functionpython @app.post("/api/generate") async def generate_text(request: Request):`This call works locally but fails when on huggingface spacesGetting the following error: "Failed to fetch data. Reason: Network response was not ok. Status: 504 - "
2023-06-01T23:09:50Z
hi@aus10powell, could you please provide more context? we might be able to help you, do you have a Space demo? or Gradio project
2023-06-01T23:25:24Z
Hi,Thanks the spaces site is:TwitterAccounts - a Hugging Face Space by aus10powell
2023-06-01T23:26:29Z
The code snippet in the post is within the app.py file if that helps. I’d be happy to add more detail but the code might make more sense. Please let me know if it needs to be broken down more.
2023-06-02T02:21:21Z
sorry I don’t have access to your logs. Considering that you app is functional overall, my guess would be that the model loading in the POST request function is not ideal, could you move this to the app loading, thus loading the language package model only oncenlp = spacy.load("en_core_web_sm")
nlp.add_pipe("sentencizer")
2023-06-03T18:55:02Z
I’ll play around with that thanks!