Littlehongman commited on
Commit
20dcad7
·
1 Parent(s): 08616cc

first commit

Browse files
Files changed (3) hide show
  1. app.py +43 -0
  2. model.png +0 -0
  3. model.py +0 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import streamlit.components.v1 as components
3
+ from PIL import Image
4
+
5
+
6
+ # Configure Streamlit page
7
+ st.set_page_config(page_title="Caption Machine", page_icon="💥")
8
+
9
+
10
+ # Force responsive layout for columns also on mobile
11
+ st.write(
12
+ """<style>
13
+ [data-testid="column"] {
14
+ width: calc(50% - 1rem);
15
+ flex: 1 1 calc(50% - 1rem);
16
+ min-width: calc(50% - 1rem);
17
+ }
18
+ </style>""",
19
+ unsafe_allow_html=True,
20
+ )
21
+
22
+ # Render Streamlit page
23
+ st.title("Image Captioner")
24
+ st.markdown(
25
+ "This app generates Image Caption using OpenAI's [GPT-2](https://openai.com/research/better-language-models) and [CLIP](https://openai.com/research/clip) model."
26
+ )
27
+
28
+ # st.subheader("Model Architecture")
29
+
30
+ # image = Image.open('model.png')
31
+
32
+ # st.image(image, caption=None, width=500)
33
+
34
+ upload_file = st.file_uploader("Upload an image:", type=['png','jpg','jpeg'])
35
+
36
+
37
+ # Checking the Format of the page
38
+ if upload_file is not None:
39
+ img = Image.open(upload_file)
40
+ st.image(img)
41
+ st.write("Image Uploaded Successfully")
42
+
43
+
model.png ADDED
model.py ADDED
File without changes