adi-123 commited on
Commit
f9fdb45
Β·
verified Β·
1 Parent(s): d427810

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -65,23 +65,24 @@ def main():
65
  st.set_page_config(page_title="🎨 Image-to-Audio Story 🎧", page_icon="πŸ–ΌοΈ")
66
  st.title("Turn the Image into Audio Story")
67
 
68
- # Allows users to upload an image file
69
  uploaded_file = st.file_uploader("# πŸ“· Upload an image...", type=["jpg", "jpeg", "png"])
70
 
71
- # Parameters for LLM model (in the sidebar)
 
72
  top_k = st.sidebar.number_input("Top-K", min_value=1, max_value=100, value=5)
73
  top_p = st.sidebar.number_input("Top-P", min_value=0.0, max_value=1.0, value=0.4)
74
  temperature = st.sidebar.number_input("Temperature", min_value=0.1, max_value=2.0, value=1.0)
75
 
76
  if uploaded_file is not None:
77
- # Reads and saves uploaded image file
78
  bytes_data = uploaded_file.read()
79
  with open("uploaded_image.jpg", "wb") as file:
80
  file.write(bytes_data)
81
 
82
  st.image(uploaded_file, caption='πŸ–ΌοΈ Uploaded Image', use_column_width=True)
83
 
84
- # Initiates AI processing and story generation
85
  with st.spinner("## πŸ€– AI is at Work! "):
86
  scenario = img2txt("uploaded_image.jpg") # Extracts text from the image
87
  story = txt2story(scenario) # Generates a story based on the image text
@@ -98,7 +99,7 @@ def main():
98
  st.markdown("---")
99
  st.markdown("## 🎧 Audio Story")
100
  st.audio("audio_story.mp3")
101
-
102
  if __name__ == '__main__':
103
  main()
104
 
 
65
  st.set_page_config(page_title="🎨 Image-to-Audio Story 🎧", page_icon="πŸ–ΌοΈ")
66
  st.title("Turn the Image into Audio Story")
67
 
68
+ # Allows users to upload an image file
69
  uploaded_file = st.file_uploader("# πŸ“· Upload an image...", type=["jpg", "jpeg", "png"])
70
 
71
+ # Parameters for LLM model (in the sidebar)
72
+ st.sidebar.markdown("# LLM Inference Configuration Parameters")
73
  top_k = st.sidebar.number_input("Top-K", min_value=1, max_value=100, value=5)
74
  top_p = st.sidebar.number_input("Top-P", min_value=0.0, max_value=1.0, value=0.4)
75
  temperature = st.sidebar.number_input("Temperature", min_value=0.1, max_value=2.0, value=1.0)
76
 
77
  if uploaded_file is not None:
78
+ # Reads and saves uploaded image file
79
  bytes_data = uploaded_file.read()
80
  with open("uploaded_image.jpg", "wb") as file:
81
  file.write(bytes_data)
82
 
83
  st.image(uploaded_file, caption='πŸ–ΌοΈ Uploaded Image', use_column_width=True)
84
 
85
+ # Initiates AI processing and story generation
86
  with st.spinner("## πŸ€– AI is at Work! "):
87
  scenario = img2txt("uploaded_image.jpg") # Extracts text from the image
88
  story = txt2story(scenario) # Generates a story based on the image text
 
99
  st.markdown("---")
100
  st.markdown("## 🎧 Audio Story")
101
  st.audio("audio_story.mp3")
102
+
103
  if __name__ == '__main__':
104
  main()
105