Textwizai / app.py
Erfan11's picture
Update app.py
e33b8ac verified
raw
history blame
1.3 kB
import streamlit as st
from text_generation import generate_text
from image_generation import generate_image_from_text
from video_generation import generate_simple_video
from PIL import Image
# Main Streamlit app
st.title("Multifunction AI App")
# Ability Selection
option = st.sidebar.selectbox("Select Functionality", ("Text Generation", "Image Generation", "Video Generation"))
# Text Generation
if option == "Text Generation":
prompt = st.text_area("Input", "Type a prompt for text generation...")
max_length = st.slider("Max Length", min_value=10, max_value=100, value=50)
if st.button("Generate Text"):
generated_text = generate_text(prompt, max_length)
st.subheader("Generated Text")
st.write(generated_text)
# Image Generation
elif option == "Image Generation":
prompt = st.text_area("Input", "Type a prompt for image generation...")
if st.button("Generate Image"):
image = generate_image_from_text(prompt)
st.image(image, caption="Generated Image", use_column_width=True)
# Video Generation
elif option == "Video Generation":
prompt = st.text_area("Input", "Type a prompt for video generation...")
if st.button("Generate Video"):
video_path = generate_simple_video(prompt)
st.video(video_path)