Spaces:
Sleeping
Sleeping
Commit
·
308641f
1
Parent(s):
f99ea1d
Delete pages/Captionize.py
Browse files- pages/Captionize.py +0 -41
pages/Captionize.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
import torch
|
| 2 |
-
import re
|
| 3 |
-
import langchain
|
| 4 |
-
from PIL import Image
|
| 5 |
-
import requests
|
| 6 |
-
import streamlit as st
|
| 7 |
-
from transformers import AutoTokenizer, ViTFeatureExtractor, VisionEncoderDecoderModel
|
| 8 |
-
|
| 9 |
-
from PIL import Image
|
| 10 |
-
import requests
|
| 11 |
-
from langchain.indexes import VectorstoreIndexCreator
|
| 12 |
-
from langchain.document_loaders import ImageCaptionLoader
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
st.set_page_config(page_title="Captionize")
|
| 16 |
-
|
| 17 |
-
st.title("🤖 Captionize")
|
| 18 |
-
st.subheader("Generate Captions for your Image...")
|
| 19 |
-
|
| 20 |
-
st.sidebar.image('./csv_analysis.png',width=300, use_column_width=True)
|
| 21 |
-
|
| 22 |
-
# Applying Styling
|
| 23 |
-
st.markdown("""
|
| 24 |
-
<style>
|
| 25 |
-
div.stButton > button:first-child {
|
| 26 |
-
background-color: #0099ff;
|
| 27 |
-
color:#ffffff;
|
| 28 |
-
}
|
| 29 |
-
div.stButton > button:hover {
|
| 30 |
-
background-color: #00ff00;
|
| 31 |
-
color:#FFFFFF;
|
| 32 |
-
}
|
| 33 |
-
</style>""", unsafe_allow_html=True)
|
| 34 |
-
|
| 35 |
-
image = st.file_uploader("Upload an image", type="jpg")
|
| 36 |
-
caption = langchain.generate_caption(image)
|
| 37 |
-
|
| 38 |
-
button = st.button("Generate Caption")
|
| 39 |
-
|
| 40 |
-
if button:
|
| 41 |
-
st.write("Caption:", caption)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|