Team Ai
Apppublic

HudaQamber/Learning_structures

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
app.py30 linesDownload Raw Back to root
1import streamlit as st2from transformers import pipeline3 4# Set Streamlit page config5st.set_page_config(page_title="StructuLearn - Structural Tutor", layout="centered")6 7# Load the Hugging Face model pipeline8@st.cache_resource9def load_model():10    return pipeline("text-generation", model="tiiuae/falcon-7b-instruct", max_length=512)11 12qa_pipeline = load_model()13 14# App title15st.title("๐Ÿ—๏ธ StructuLearn: Ask About Structural Concepts")16st.write("This is an AI-powered learning tool for junior structural engineers. Ask any question about structural design, codes, or analysis.")17 18# User input19user_question = st.text_input("๐Ÿง  What do you want to learn about?", placeholder="e.g. What is buckling in columns?")20 21if st.button("Get Answer"):22    if user_question.strip() == "":23        st.warning("Please enter a question.")24    else:25        with st.spinner("Thinking like an engineer..."):26            response = qa_pipeline(f"Explain like I'm a structural engineering intern: {user_question}")27            answer = response[0]['generated_text']28            st.subheader("๐Ÿ“˜ Explanation")29            st.write(answer)30