Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM
Machine Learning
Machine Learning
Machine Learning & AI
Manage Data
MLOps
Natural Language Processing
NumPy
Pandas
Polars
PySpark
Python Tips
Python Utilities
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

PyWebIO: Write Interactive Web App in Script Way Using Python

Table of Contents

PyWebIO: Write Interactive Web App in Script Way Using Python

Have you ever wanted to create a web application in only several lines of Python code? If you are looking for something that is easier to learn than Django and Flask, but more customizable than Streamlit, you will love PyWebIO.

PyWebIO is a Python library that allows you to build simple web applications without the knowledge of HTML and Javascript. The GIF above shows how some of the things you can do with PyWebIO.

Link to the article.

Link to the source code.

 

 

2 thoughts on “PyWebIO: Write Interactive Web App in Script Way Using Python”

  1. Uday Guntupalli

    Hey Khuyen,
    Thank you for this great tip. I attempted to try an example of the same, however the web page never really loads. Do you know why that could happen or how to fix that ?

    “`python
    import pandas as pd
    from pywebio.input import file_upload
    from pywebio.output import put_table, put_loading
    from pywebio import start_server
    import csv
    import re

    def app():
    file = file_upload(label=’Upload your CSV file’, accept=’.csv’)
    content = file[‘content’].decode(‘utf-8′).splitlines()

    df = content_to_pandas(content)
    create_profile(df)

    def create_profile(df: pd.DataFrame):
    put_table(df.to_dict())

    def content_to_pandas(content: list):
    with open(“tmp.csv”, “w”) as csv_file:
    writer = csv.writer(csv_file, delimiter=’\t’)
    for line in content:
    writer.writerow(re.split(‘\s+’, line))
    return pd.read_csv(“tmp.csv”)

    if __name__ == ‘__main__’:
    start_server(app, port=37791, debug=True)
    “`

    ![image](https://user-images.githubusercontent.com/47903157/113454732-7e831d00-93ce-11eb-9ef4-a135d3ee104b.png)

    Regards
    Uday

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran