Download app.py from Ai1996/Autos: direct link, hf CLI and curl.
- Browser
- Download file 873 Bytes
-
https://huggingface.co/spaces/Ai1996/Autos/resolve/main/app.py
- Command line
-
hf download hf://spaces/Ai1996/Autos/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Ai1996/Autos/resolve/main/app.py
873 Bytes
| import streamlit as st | |
| import pandas as pd | |
| from groq import Groq | |
| # Load dataset | |
| df = pd.read_csv("auto_companies_dataset.csv") | |
| # Set up Groq API | |
| groq_api_key = st.secrets["GROQ_API_KEY"] | |
| client = Groq(api_key=groq_api_key) | |
| # Streamlit UI | |
| st.title("Automotive Insights App") | |
| st.write("Explore data and get AI-generated answers about auto companies.") | |
| # Show the dataset | |
| st.subheader("Company Dataset") | |
| st.dataframe(df) | |
| # Ask a question | |
| question = st.text_input("Ask a question about the automotive industry:") | |
| if question: | |
| response = client.chat.completions.create( | |
| model="mixtral-8x7b-32768", | |
| messages=[ | |
| {"role": "system", "content": "You are an expert in the automotive industry."}, | |
| {"role": "user", "content": question} | |
| ] | |
| ) | |
| st.markdown("**AI Response:**") | |
| st.write(response.choices[0].message.content) |