예제 #1
0
파일: cli.py 프로젝트: Doki064/SWE_IT076IU
def main_hello(ctx):
    """Executes when run `wms hello`."""
    import sys

    filename = _demo.__file__
    sys.argv = ["streamlit", "run", filename]
    sys.exit(_st_cli.main())
예제 #2
0
def run(
    ctx, app="app_menu", lang=None, debug=False, keep_cache=False, clear_cache_all=False
):
    """
    Run the selected app.
    """
    from streamlit.cli import main

    if not keep_cache:
        clear_cache(ctx, clear_cache_all)

    sys.argv = ["streamlit", "run", f"pydemic_ui/apps/{app}.py"]
    os.environ.update(
        {
            "STREAMLIT_BROWSER_GATHER_USAGE_STATS": "false",
            "STREAMLIT_SERVER_FILE_WATCHER_TYPE": "none",
            "DEBUG": str(debug).lower(),
            "LANG": lang or os.environ.get("LANG", "C"),
        }
    )
    main()
예제 #3
0
def main():
    """ Run different modules based on the appropriate command line flags that are selected by the user."""
    # create object to access actual arguments
    clArgs = CommandLineParse()
    # run file clean module if annotate is selected and see is not
    if clArgs.args.annotate is True and clArgs.args.see is False:
        fileClean = fc.SeriesData(
            clArgs.args.output,
            clArgs.args.input,
            clArgs.args.types,
        )
        fileClean.myGeneCall()
        fileClean.combineDataFrame()
        fileClean.dataframeOutputter()
    # run existing data if both annotate and see are false
    elif clArgs.args.annotate is False and clArgs.args.see is False:
        fc.ExistingData(clArgs.args.input)
    # run visualization module if see is selected and annotate is not
    elif clArgs.args.see is True and clArgs.args.annotate is False:
        sys.argv = ["streamlit", "run", "graphVisualization.py"]
        sys.exit(stcli.main())
예제 #4
0
def webapp():
    '''serves a web app to plot flight data'''

    sys.argv = ["streamlit", "run", "app.py"]
    sys.exit(stcli.main())
예제 #5
0
import sys
import streamlit.cli as stcli
import os

target_path = os.path.join(os.path.dirname(__file__), 'app.py')

if __name__ == '__main__':
    sys.argv = ["streamlit", "run", target_path, "--global.developmentMode=false"]
    sys.exit(stcli.main())
예제 #6
0
def run_streamlit():
    dirname = Path(os.path.dirname(__file__)).parent
    filename = os.path.join(dirname, 'app.py')
    sys.argv = ["streamlit", "run", filename]
    sys.exit(stcli.main())
예제 #7
0
# Copyright 2018-2021 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
from streamlit.cli import main

if __name__ == "__main__":
    # So that the Streamlit server sees the same command line string
    # whether streamlit is called directly or via `python -m streamlit`.
    sys.argv[0] = "streamlit"

    main()
def main():
    migrations.run_migrations()
    sys.argv = ["streamlit", "run", __file__]
    sys.exit(st_cli.main())
import matplotlib.pyplot as plt
import pickle
from PIL import Image
from pyngrok import ngrok

st.title("Image Classifier using Machine Learning")
st.text('Upload the Image')

model = pickle.load(open('image_model.p', 'rb'))
uploaded_file = st.file_uploader("Choose an image...", type='jpg')
if uploaded_file is not None:
    img = Image.open(uploaded_file)
    st.image(img, caption='Uploaded image')

    if st.button('Predict'):
        categories = ["alien", "predator"]
        st.write('Result....')
        flat_image = []
        image = np.array(img)
        image_resized = resize(image, (150, 150, 3))
        flat_image.append(image_resized.flatten())
        flat_image = np.array(flat_image)
        plt.imshow(image_resized)
        output = model.predict(flat_image)
        output = categories[output[0]]
        st.title(f'Predicted output: {output}')

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
예제 #10
0
def main_hello(ctx):
    import sys

    filename = demo.__file__
    sys.argv = ["streamlit", "run", filename]
    sys.exit(stcli.main())
import streamlit.cli as cli

if __name__ == '__main__':
    cli.main()
예제 #12
0
def streamlit():
    sys.argv = ["streamlit", "run", "apps/app.py"]
    sys.exit(stcli.main())
예제 #13
0
# Copyright 2018-2022 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
from streamlit.cli import main

if __name__ == "__main__":
    # Set prog_name so that the Streamlit server sees the same command line
    # string whether streamlit is called directly or via `python -m streamlit`.
    main(prog_name="streamlit")