Initial commit

This commit is contained in:
Errant committed 2026-04-22 12:03:53 -07:00
commit a6b4cda81f
4 files changed
+69

No files matched your search

+1
View File
@@ -0,0 +1 @@
venv/
+22
View File
@@ -0,0 +1,22 @@
# app/Dockerfile
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
COPY src src
RUN pip3 install -r requirements.txt
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
+4
View File
@@ -0,0 +1,4 @@
streamlit==1.55.0
moviepy==2.2.1
pygifsicle==1.1.0
wand==0.7.0
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env python3
import streamlit as st
import tempfile
from os.path import splitext
from moviepy import (
VideoFileClip
)
from moviepy.video.fx import (
Resize
)
from moviepy.video.io.gif_writers import write_gif_with_imageio
from pygifsicle import gifsicle
from wand.image import Image
st.title("GifMaker")
input_file = st.file_uploader("Upload a video or GIF file")
if input_file is not None:
nameparts = splitext(input_file.name)
with tempfile.NamedTemporaryFile() as temp_input_file:
temp_input_file.write(input_file.read())
temp_input_file.seek(0)
input_video = VideoFileClip(temp_input_file.name)
preview = input_video.get_frame(1.0)
st.image(preview, "Preview")
result = input_video.rotated(270.0, expand=True).with_fps(15)
with tempfile.NamedTemporaryFile(suffix=".gif") as first_gif_file:
write_gif_with_imageio(result, first_gif_file.name)
with tempfile.NamedTemporaryFile(suffix=".gif") as second_gif_file:
gifsicle(first_gif_file.name,
second_gif_file.name,
optimize=False,
colors=255,
options=['--resize', '367x447'])
with Image(filename=second_gif_file.name) as gif_image:
gif_image.coalesce()
st.download_button("Download",
gif_image.make_blob('gif'),
f'{nameparts[0]}.gif')