A Flask-based web application that dynamically processes user queries with placeholders, replaces them with dataset entities, and retrieves data using the Groq API.
- Dynamic Placeholder Replacement
- Groq API Integration
- User-Friendly Interface
- Secure API Key Management
- Robust Error Handling
- Python 3.7+
- pip
-
Clone the Repository
git clone https://github.com/yourusername/groq-data-extraction-flask.git cd groq-data-extraction-flask -
Create & Activate Virtual Environment
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Set Environment Variables
export GROQ_API_KEY='your_groq_api_key' # Unix/Mac set GROQ_API_KEY=your_groq_api_key # Windows
-
Prepare Dataset
- Ensure your dataset is loaded into the
dfDataFrame inapp.py.
- Ensure your dataset is loaded into the
-
Run the Application
python app.py
-
Access via Browser
- Navigate to
http://127.0.0.1:5000/and submit your query with placeholders like{Company}.
- Navigate to
- {Company}: Will be replaced with entries like "OpenAI", "Google", or "Microsoft".
- {Tourism}: Will be replaced with entries like "Eiffel Tower", "Great Wall", or "Statue of Liberty".
- {Vitamins}: Will be replaced with entries like "Vitamin C", "Vitamin D", or "Vitamin B12".
When you submit the above query through the application:
- Placeholder Detection: The app identifies all placeholders within curly braces
{}. - Entity Replacement: Each placeholder is replaced with corresponding unique values from the dataset.
- API Processing: The customized queries are sent to the Groq API to retrieve relevant data.
- Results Display: Extracted information for each entity-placeholder combination is displayed on the results page.
For example, one of the processed queries might be:
The application will generate and display the extracted data based on this customized query.