bdjwhdwjb
commited on
Upload 3 files
Browse files- Dockerfile +30 -0
- app.py +23 -0
- requirements.txt +0 -0
Dockerfile
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Python image from the Docker Hub
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set environment variables to avoid Python writing .pyc files and buffering output
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
+
ENV PYTHONUNBUFFERED=1
|
7 |
+
|
8 |
+
# Set the working directory in the container
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Install system dependencies
|
12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
13 |
+
gcc \
|
14 |
+
&& rm -rf /var/lib/apt/lists/*
|
15 |
+
|
16 |
+
# Copy the requirements file into the container
|
17 |
+
COPY requirements.txt .
|
18 |
+
|
19 |
+
# Install Python dependencies
|
20 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
21 |
+
pip install --no-cache-dir -r requirements.txt
|
22 |
+
|
23 |
+
# Copy the rest of the application code into the container
|
24 |
+
COPY . .
|
25 |
+
|
26 |
+
# Expose the port the app runs on
|
27 |
+
EXPOSE 8080
|
28 |
+
|
29 |
+
# Define the command to run the application
|
30 |
+
CMD ["python", "app.py"]
|
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template, request
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
app = Flask(__name__)
|
5 |
+
|
6 |
+
# Load data from Excel
|
7 |
+
df = pd.read_excel('data/Songs_by_Region_with_Location.xlsx')
|
8 |
+
|
9 |
+
@app.route('/')
|
10 |
+
def index():
|
11 |
+
# Convert data to a format suitable for the frontend
|
12 |
+
data = df.to_dict(orient='records')
|
13 |
+
return render_template('index.html', data=data)
|
14 |
+
|
15 |
+
@app.route('/search', methods=['GET'])
|
16 |
+
def search_song():
|
17 |
+
song = request.args.get('song', '')
|
18 |
+
# Redirect to YouTube search results for the song
|
19 |
+
youtube_url = f"https://www.youtube.com/results?search_query={song}"
|
20 |
+
return f"<script>window.open('{youtube_url}', '_blank');</script>"
|
21 |
+
|
22 |
+
if __name__ == '__main__':
|
23 |
+
app.run(debug=True, port=8080)
|
requirements.txt
ADDED
File without changes
|