File size: 1,148 Bytes
f9d2af8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
from diffusers import StableDiffusionPipeline, AutoencoderKL
from torchvision import models

tokenizer = AutoTokenizer.from_pretrained("Salesforce/codegen-350M-multi")
model = AutoModelForCausalLM.from_pretrained("Salesforce/codegen-350M-multi")
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
video_model = models.resnet50(pretrained=True)
st.title("FallnAI Inference App")
st.subheader("Coding Model")
user_input = st.text_input("Enter your code:")
if st.button("Generate"):
    result = pipeline("text-generation", model=model, tokenizer=tokenizer)(user_input)
    st.write(result[0]['generated_text'])
st.subheader("Stable Diffusion Model")
prompt = st.text_input("Enter your prompt:")
if st.button("Generate"):
    image = pipe(prompt).images[0]
    st.image(image)
st.subheader("Video Model")
video_file = st.file_uploader("Upload a video file:", type=["mp4", "avi"])
if video_file is not None:
    video_bytes = video_file.getvalue()
    st.video(video_bytes)
    video_transformed = video_model(video_bytes)