Spaces:
Build error
Build error
SHAMIL SHAHBAZ AWAN commited on
Update app.py
Browse files1 unmodified line23456578910111217 unmodified lines303132293031323334353637383940414224 unmodified lines6768697071727374751 unmodified lineimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as sns
try:from groqflow.groqmodel import GroqModel from groqflow.groqmodel import GroqModelexcept ImportError as e: st.error(f"Failed to import GroqModel. Please ensure all dependencies are installed correctly. Error: {e}")
# Configure pagest.set_page_config(page_title="Data Augmentation App", layout="wide")17 unmodified linesst.sidebar.markdown("Supported formats: CSV, Excel")
# Load Groq API key from secretsgroq_api_key = st.secrets["HUGGINGFACE_KEY"]
# Load Groq modelgroq_model = GroqModel("llama3-8b-8192", api_key=groq_api_key)try: groq_api_key = st.secrets["HUGGINGFACE_KEY"] groq_model = GroqModel("llama3-8b-8192", api_key=groq_api_key)except KeyError: st.error("API key not found in secrets. Please configure your `HUGGINGFACE_KEY` in Streamlit secrets.")except Exception as e: st.error(f"Error initializing GroqModel: {e}")
def load_file(uploaded_file): """Load the uploaded file."""24 unmodified linesdef handle_query(data, query): """Handle user query using Groq API.""" try: if not groq_model: st.error("GroqModel is not initialized. Check for errors in setup.") return prompt = f"Given the dataset: {data.to_dict(orient='records')}, answer the following: {query}" response = groq_model.generate(prompt) st.write("Response:", response)app.py+15-5