From 55215a0edbc0bffb59084f130fa566c629527470 Mon Sep 17 00:00:00 2001 From: Regis David Souza Mesquita Date: Sun, 2 Mar 2025 03:28:36 +0000 Subject: [PATCH] Adds frontend --- Dockerfile | 27 ++++++++++++++++++ templates/index.html | 67 ++++++++++++++++++++++++++++++++++++++++++++ vibe/server.py | 6 +++- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 templates/index.html diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4ac088b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Use an official Python runtime as a parent image +FROM python:3.9-slim + +# Install system dependencies including ffmpeg +RUN apt-get update && apt-get install -y --no-install-recommends \ + ffmpeg \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Set environment variables for litellm API key and model (users can override these) +ENV LITELLM_API_KEY="" +ENV MODEL_NAME="mistral-small-latest" + +# Set working directory +WORKDIR /app + +# Copy the current directory contents into the container at /app +COPY . . + +# Install Python dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Expose port 5000 for the Flask server +EXPOSE 5000 + +# Command to run the Flask server +CMD ["python", "vibe/main.py", "--serve"] \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..d948cd0 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,67 @@ + + + + + vibe: Article Summarization & TTS Pipeline + + + +
+

Welcome to vibe

+

Enter your interests below to generate a summary MP3 of the latest Computer Science research articles.

+
+ + +
+ +
+ +
+ + + \ No newline at end of file diff --git a/vibe/server.py b/vibe/server.py index b7886c1..d7233e0 100644 --- a/vibe/server.py +++ b/vibe/server.py @@ -1,4 +1,4 @@ -from flask import Flask, send_file, request, jsonify +from flask import Flask, send_file, request, jsonify, render_template import logging from .orchestrator import process_articles from .config import CACHE_DIR @@ -34,5 +34,9 @@ def process_endpoint(): logger.info("Process complete. Returning MP3 file.") return send_file(output_mp3, as_attachment=True) +@app.route("/") +def index(): + return render_template("index.html") + if __name__ == "__main__": app.run(debug=True) \ No newline at end of file