Testys commited on
Commit
380880b
1 Parent(s): 27880c4

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -11
main.py CHANGED
@@ -14,9 +14,11 @@ def main():
14
  user_input = st.selectbox(label="Text Input or Image Input", options=["Text", "Image", "Image URL"])
15
  if user_input == "Text":
16
  text_input = st.text_input(label="Put in your Idea, Let's generate a matching Topic Sentence🤗🤗")
17
- generated_topics = topic_generator.generate_topics(text_input)
18
- for idx, topic in enumerate(generated_topics, 1):
19
- st.write(f"Topic {idx}: {topic}")
 
 
20
  elif user_input == "Image":
21
  img_input = st.file_uploader(label="Drop an Image you have been admiring, Let's see what we can do🤔🤔",
22
  type=["jpg", "png", "jpeg"],
@@ -33,14 +35,15 @@ def main():
33
  elif user_input == "Image URL":
34
  url_input = st.text_input(label="Do you have a link to the Image you would like to drop, Go Ahead and We got "
35
  "you covered😉😉")
36
- url_img = check_url(url_input)
37
- img_load = load_image(url_img)
38
- caption = img_caption.get_caption(img_load)
39
- st.image(image=img_load, caption=caption, width=250, height=250)
40
- # Generate and display topics
41
- generated_topics = topic_generator.generate_topics(caption)
42
- for idx, topic in enumerate(generated_topics, 1):
43
- st.write(f"Topic {idx}: {topic}")
 
44
 
45
 
46
  if __name__ == "__main__":
 
14
  user_input = st.selectbox(label="Text Input or Image Input", options=["Text", "Image", "Image URL"])
15
  if user_input == "Text":
16
  text_input = st.text_input(label="Put in your Idea, Let's generate a matching Topic Sentence🤗🤗")
17
+ if text_input is not None:
18
+ generated_topics = topic_generator.generate_topics(text_input)
19
+ for idx, topic in enumerate(generated_topics, 1):
20
+ st.write(f"Topic {idx}: {topic}")
21
+
22
  elif user_input == "Image":
23
  img_input = st.file_uploader(label="Drop an Image you have been admiring, Let's see what we can do🤔🤔",
24
  type=["jpg", "png", "jpeg"],
 
35
  elif user_input == "Image URL":
36
  url_input = st.text_input(label="Do you have a link to the Image you would like to drop, Go Ahead and We got "
37
  "you covered😉😉")
38
+ if url_input is not None:
39
+ url_img = check_url(url_input)
40
+ img_load = load_image(url_img)
41
+ caption = img_caption.get_caption(img_load)
42
+ st.image(image=img_load, caption=caption, width=250, height=250)
43
+ # Generate and display topics
44
+ generated_topics = topic_generator.generate_topics(caption)
45
+ for idx, topic in enumerate(generated_topics, 1):
46
+ st.write(f"Topic {idx}: {topic}")
47
 
48
 
49
  if __name__ == "__main__":