Arduino-Master / app.py
duatanzeel's picture
Create app.py
f43edf2 verified
raw
history blame
958 Bytes
import streamlit as st
from transformers import pipeline
# Set up the Hugging Face model pipeline (text generation or QA)
st.title("πŸ€–πŸ“Ÿ Arduino Expert Chatbot")
st.markdown("Get help with Arduino code, circuit diagrams, and projects.")
# Load the model (e.g., 'mistralai/Mixtral-8x7B-Instruct-v0.1' or any suitable)
@st.cache_resource
def load_model():
return pipeline("text-generation", model="mistralai/Mixtral-8x7B-Instruct-v0.1")
model = load_model()
# User input
query = st.text_area("Ask your Arduino question here πŸ‘‡", height=150)
if st.button("Get Answer"):
if query:
with st.spinner("Thinking... πŸ€–"):
response = model(query, max_length=512, do_sample=True, temperature=0.7)
st.success(response[0]['generated_text'])
else:
st.warning("Please enter a question about your Arduino project.")
# Footer
st.markdown("---")
st.markdown("Made with ❀️ using Hugging Face and Streamlit")