Spaces:
Sleeping
Sleeping
| 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) | |
| 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") | |