Question:
I’ve deployed my repl as a background worker. I get the message ‘Your Repl has been deployed!’ on https://bg-remover-sreeramanmg.replit.app/
What I want to see is https://bgremover.sreeramanmg.repl.co/
Question:
I’ve deployed my repl as a background worker. I get the message ‘Your Repl has been deployed!’ on https://bg-remover-sreeramanmg.replit.app/
What I want to see is https://bgremover.sreeramanmg.repl.co/
Hey @SreeramanMG welcome to the forums!
If you have a deployment, to my knowledge, you can no longer access the repl.co
, it becomes the replit.app
. I hope this helps!
Why am I just seeing Your Repl has been deployed! message in the page and not the contents of my index.html file?
Are you seeing the message in the HTML file.
@SreeramanMG huh, that is odd. Can you share a link to the cover page of your project (In your Repl press your Repl name in the top left corner and press Cover Page
)?
https://replit.com/@SreeramanMG/BGRemover?v=1
This is the coverpage
It is running fine when I click on Run there.
Hey @SreeramanMG!
When you deploy your Repl as a background worker, that doesn’t ensure that your Repl opens a port when starting up the Deployment. Instead, you should deploy your Repl as a web server in order for it to host on a port.
Please let me know if that works!
Hey,
When I deploy it as a web server. It gives the error
hostingpid1: an open port was not detected
But in my code I have
if __name__ == "__main__":
app.run(host='0.0.0.0', port=int(os.getenv('PORT', 8080)), debug=True)
Even tried setting the PORT as a Key in the Deployment Secret like the Replit AI suggested.
Still getting the error
hostingpid1: an open port was not detected
Using debug during deployment is undesirable, as the server may not start.
Removed debug=True. Still no luck.
Thanks for the info! What deployment type are you using?
When I try to deploy as a web server I get the error
hostingpid1: an open port was not detected
and the deployment fails. So the current successful deployment is the ‘background-worker’ where all I see is the ‘Your reply has been successfully deployed’ message on the page instead of my index.html file.
Thanks! I am working with the team to resolve this. I will keep you updated!
Hey @SreeramanMG, the issue is that your deployment takes too long to start up. We have a one minute timeout from the time that the deployment is started for it to start listening on a port.
The line that is taking a long time to execute is this one:
from rembg import remove
Presumably because it is loading up some LLM models or something in the background at import time.
One thing you can do is to move the import from the top level down into one of your functions. For example, you might change the remove_background function to look something like this:
@app.route('/remove-background', methods=['POST'])
def remove_background():
from rembg import remove
image_file = request.files.get('image')
# the rest of your code...
This will move the loading cost to the first time that the /remove-background endpoint is hit, which will be slow, but subsequent calls will be just as fast as they are now.
That worked! Thanks a lot everyone
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.