Spaces:
Sleeping
Sleeping
update app
Browse files4 unmodified lines5678910111213141516171 unmodified line192021222324252627282921 unmodified lines5152535455565758596061626364654 unmodified linesst.title("Coffe machine captioning app")uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])model_id = "Fer14/paligemma_coffe_machine_caption"model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)processor = PaliGemmaProcessor.from_pretrained(model_id)# Instructions for Tesseract OCR1 unmodified linest.sidebar.write("""1. Upload an image using the file uploader.2. Wait for the app to process and extract text from the image.3. The extracted text will be displayed in the text area.""")prompt = (f"Generate a caption for the following coffee maker image. The caption has to be of the following structure:\n"21 unmodified lines)st.write("Generating caption for the image...")with tqdm(total=100) as pbar:output = model.generate(**inputs, max_length=1000)pbar.update(100)out = processor.decode(output[0], skip_special_tokens=True)[len(prompt) :]# Display the extracted textst.text_area("Coffe machine description", out, height=300)4 unmodified lines56789101112131415161718191 unmodified line21222324252627282930313233343521 unmodified lines575859606162636465666768694 unmodified linesst.title("Coffe machine captioning app")with st.spinner('Loading model and tokenizer...'):model_id = "Fer14/paligemma_coffe_machine_caption"model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)processor = PaliGemmaProcessor.from_pretrained(model_id)st.success('Model loaded!')# Instructions for Tesseract OCR1 unmodified linest.sidebar.write("""1. Upload an image using the file uploader.2. Wait for the app to process and generate the caption.3. The caption will be displayed in the text area.4. Enjoy your caption!""")uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])prompt = (f"Generate a caption for the following coffee maker image. The caption has to be of the following structure:\n"21 unmodified lines)with st.spinner('Generating caption...'):output = model.generate(**inputs, max_length=1000)out = processor.decode(output[0], skip_special_tokens=True)[len(prompt) :]# Display the extracted textst.text_area("Coffe machine caption", out, height=300)
app.py+14-10