ss2code / app.py
keremsabirli's picture
added trust_remote_code
83e6a92
raw
history blame
733 Bytes
from tkinter import Image
import streamlit as st
from transformers import pipeline
model_name = "HuggingFaceM4/VLM_WebSight_finetuned"
image_to_code = pipeline("image-to-text", model=model_name, trust_remote_code=True)
st.title("Image to Code Converter")
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "png"])
if uploaded_file is not None:
# To see details
st.image(uploaded_file, caption='Uploaded Image.', use_column_width=True)
st.write("")
st.write("Converting image to code...")
# Convert the file to an image
image = Image.open(uploaded_file)
# Process the image
code_result = image_to_code(image)
# Display the code
st.code(code_result[0]['generated_text'])