# app.py | |
import streamlit as st | |
from model import load_pipeline, generate_3d_gif | |
from PIL import Image | |
# Load pipeline once when the app starts | |
pipe = load_pipeline() | |
st.title("3D Model to GIF Generator") | |
prompt = st.text_input("Enter a prompt for the 3D model:", "a shark") | |
if st.button("Generate 3D GIF"): | |
with st.spinner("Generating 3D model..."): | |
gif_path = generate_3d_gif(pipe, prompt) | |
# Display the GIF | |
st.image(gif_path) | |
# Provide a download link | |
with open(gif_path, "rb") as file: | |
st.download_button( | |
label="Download GIF", | |
data=file, | |
file_name="generated_3d.gif", | |
mime="image/gif" | |
) | |