How can I deploy a streamlit application in repl.it? - python

I installed/imported streamlit, numpy, and pandas but I do not know how I can see the charts I have made. How do I deploy it on repl.it?

Actually, you can.
Add the streamlit by going to Packages, searching for streamlit, and clicking on install
[]
Write your code (for example in a file called app.py)
Go to the shell of Repl.it and type streamlit run app.py (assuming your app is indeed called that way)
It might ask you if you want to register your email: either enter or press ENTER
Wait a bit: a "Firefox" window will open in Repl.it with the app

You can not deploy streamlit application within repl.it because
In order to protect against CSRF attacks, we send a cookie with each request.
To do so, we must specify allowable origins, which places a restriction on
cross-origin resource sharing.
One solution is push your code from repl.it to GitHub. Then deploy from GitHub on share.streamlit.io.

First picture: your streamlit app code will be in here.
Second one: main.py to drive the streamlit app.
Last one: you can click Start button for the program to run.

Related

Run Python script On Heroku or DG Ocean when click button on web

Is it possible to run python script, which I will upload on Heroku or DG Ocean droplet (depending on which of them is most comfortable for what I am trying to do), from external website button?
My scenario: I have scrapper and I want to run it when user clicks on button on my webpage, so scrapper will scrape current data and will show it to user. Is it possible to do? or if we have any other way?
For others, who will have same things in the feature: So, i am going to make FLASK app to use DG Droplet or Heroku, after i will import Flask app using Iframe in my Web project and use only BUTTON, like this i will use my scraper on my Webpage.
Thanks

Streamlit azure deployment please wait screen error

Hi I have been trying to deploy a streamlit app in azure for the past couple of days. A simple app like
import streamlit as st
def main():
st.write('hello all')
if __name__=='__main__':
main()
even with requirements.txt, a docker file, trying to push the docker image to azure container registry, all process are done right. There are even no errors so that i can debug them. The app just opens up in azure and freezes in the please wait screen. Please can someone help. I have tried everything, github deployment local deployment. I have been following the below articles.
https://saitracychen.medium.com/deploy-a-streamlit-app-to-azure-126452e7df6d
https://towardsdatascience.com/deploying-a-streamlit-web-app-with-azure-app-service-1f09a2159743
What am not getting is if this is a recent issue specifically with streamlit and azure or am i doing something wrong. attaching my problem below. I have also managed to capture a HAR file from the frozen page if anyone can help with it. If anyone can document the recent process and changes we have to make to deploy in azure that will be great as the support on this topic is pretty thin online.
TLDR: you need to get at least a B1 appservice plan. The FREE one will not work with Streamlit (and apps using WebSockets).
After a couple of hours trying to find the answer to the same answer, I found out what it was. I wanted to deploy a streamlit app, but was stuck at the same place after following the guidance. A Ctrl+Maj+J showed in the "Please wait" page that WebSockets were an issue. It appears WebSockets will not work for FREE Linux appservice plans, and after recreating a B1 appservice plan (as in the guidance), it worked.

What tools to deploy webserver running numpy behind?

If I am given a dataset (say excel file), I would like to deploy a webserver on which I upload this excel file, it runs python/numpy code and displays some figure.
I could also have some checkboxes on the website that would change the parameters in the code.
What tools would you recommend for doing that? What would be the easiest way?
For now I have the python code on jupyter notebook and use:
from ipywidgets.embed import embed_minimal_html
embed_minimal_html('export.html', views=[fig])
to see my figure (fig) locally, by running: python -m http.server 8080
I would like this to be deployed and choosing the file to upload.
In my opinion Django may be the best option for you. It requires Python knowledge and basic HTML/CSS -for basic usage-, that is why I thought it is the best option.
You can develope python scripts and user can able to modify the input for that python script and easily create an dashboard with graphics/calculations.
You may want to check Vitor's website:
Simple is the Best by Vitor Freitas
Use a Github repo to host your code, and then share it via MyBinder.org. An example, that is simpler than yours, but like what you describe in some ways is here. When you get there click the launch badge and a temporary session will spin up. In the notebook that comes up, you can do Run All Cells under the Run menu. The session dies after 10 minutes of inactivity. You can download useful information. See more about the MyBinder project here. I am taking advantage of the drag and drop for file upload that comes with JupyterLab here but there are file upload widgets (see below).
That example one doesn't have fancy widgets like toggles to make the choices but you can add them. For example, see the appmode demo. (Click launch binder button on the page.) You'll see you can have the widgets in the notebook or in the 'appmode'. You can make the interactions with the widgets fancier, too. Some examples featured in the Voila gallery will give you more of an idea of what is possible with the widgets and communicating to your underlying python. All those are on Github and served via temporary sessions from MyBinder.org. Keep in mind those apps can run in the notebook if you want that. The widgets work there in the notebook versions as well, too. And you can directly link to the notebook mode if you prefer, as shown under the heading 'Direct links to start out in notebook mode' here.

Python sample on Bluemix displays source code instead of HTML output - why?

I am trying out Python on Bluemix. To do this I decided to move an example from a book that worked fine on my Windows laptop. I created the Bluemix example app, then replaced the index.html with the html file from the sample and built my directory tree beneath the static directory. The server starts up fine and displays the intro html file as expected, but when I click on a link that should build my html page it displays the page as source code instead of executing it. On Windows this works perfectly. My call to the page looks like this:
My data.
I have heard that on Linux environments you sometimes need to point out the python executable, but what is the right location of that in a Bluemix environment? Another question would be if the .py file is set to executable, but I don't know how you set such a thing in Bluemix.
All help is appreciated.
You can't directly link to a Python file in a Python webapp. You should use something like Flask to serve your application. Flask can do routing for you.
Additionally, in Bluemix and other Platform as a Services' there is only a single binary entry point to your app. You can't have multiple binary entry points.
See this example app on how to deploy a Flask app.
Additionally, you can click the button below to directly deploy the example app to Bluemix.

Can't run coursebuilder in google app engine

It is really weird that after clicking run button, it does nothing and also no log and show a clock sign on the first column.
It works normally before. However, after I messed up my python environment, the google coursebuilder can't run web application. That's my guessing. When I run which python.it only shows:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
These let me feel like I have no way to solve it!Are there anyone who came across this problem before? Any ideas or suggestions?
Updated: I follow suggestions to use command line to run web application on GAE. It reminds me here:
Update: The error message shows that GAE can't get the allocated port and domain. The reason why it happens is that when I use command line to run the web application, I also open GAE GUI to run a web app with the same port number.
So the way to solve it is to close the GAE GUI and free the port. Or we also could designate another kind of port number with command line.(--port=XXXX and --admin_port=YYYY). Or take a look at the doc:
Again thanks for the help of Mihail R!
The OP had multiple issues with GAE setup which were resolved by simply reinstalling the GAE Launcher and making sure the app was first copied into Applications from the .dmg file, then ran from the Applications instead of from inside the .dmg file, and appropriate permissions were suppose to be given so that GAE Launcher created the symlinks it needed to work properly.
More instructions on proper GAE SDK installation can be found here: https://cloud.google.com/appengine/downloads after clicking on the needed SDK and then the OS the SDK will be installed on.

Categories