Spaces:
Runtime error
Runtime error
Download app.py from harish-lab/flow-visualiser: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/harish-lab/flow-visualiser/resolve/main/app.py
- Command line
-
hf download hf://spaces/harish-lab/flow-visualiser/app.py
-
curl -L -o app.py https://huggingface.co/spaces/harish-lab/flow-visualiser/resolve/main/app.py
1.99 kB
| import streamlit as st | |
| from stream_functions import calculate_stream_function, calculate_velocity_field | |
| from visualization import create_flow_visualization, display_equations | |
| from ui_components import create_sidebar_controls | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| def main(): | |
| st.set_page_config(page_title="Flow Visualizer", layout="wide") | |
| st.title("Flow Visualizer") | |
| st.write("""This app aims to improve the understanding through the visualisation of the flow. Streamlines can be thought as the paths taken by a fluid particle and are described using Stream functions (ψ). Stream functions are scalars that describe fluid flow patterns where streamlines are lines of constant ψ. The velocity components can be derived from the stream function as: u = ∂ψ/∂y and v = -∂ψ/∂x """) | |
| # Two columsn | |
| col1, col2 = st.columns([1, 2]) | |
| # Left column | |
| with col1: | |
| # Heading for the side bar | |
| st.subheader("Flow Parameters") | |
| # Get all user inputs and parameters from the controls in the left column | |
| pattern_type, params, domain_settings, viz_settings = create_sidebar_controls(col1) | |
| st.subheader("Developers") | |
| st.write("<a href='https://www.linkedin.com/in/nandurdikarvijay/'>Vijay Nandurdikar</a>", unsafe_allow_html=True) | |
| # Right column | |
| with col2: | |
| # Extract domain settings | |
| domain_size = domain_settings["domain_size"] | |
| grid_points = domain_settings["grid_points"] | |
| # Create visualization based on user parameters | |
| create_flow_visualization( | |
| pattern_type, | |
| params, | |
| domain_size, | |
| grid_points, | |
| viz_settings | |
| ) | |
| # Display relevant equations for the selected flow pattern | |
| # Pass params to display_equations for custom functions | |
| display_equations(pattern_type, params) | |
| # Main function | |
| if __name__ == "__main__": | |
| main() |