AhsanRazi commited on
Commit
3b5eec4
·
verified ·
1 Parent(s): 35c732d

Update pages/Custom.py

Browse files
Files changed (1) hide show
  1. pages/Custom.py +7 -4
pages/Custom.py CHANGED
@@ -47,10 +47,13 @@ graph = builder.compile()
47
  st.title("Generate Custom Title Blog")
48
  input_data = st.text_input("Enter a Title for your blog:")
49
 
50
-
51
- if st.button("Generate Blog"):
52
- content = graph.invoke({"final_topic": input_data})
53
- st.markdown(content['image_formated_blog'])
 
 
 
54
 
55
 
56
 
 
47
  st.title("Generate Custom Title Blog")
48
  input_data = st.text_input("Enter a Title for your blog:")
49
 
50
+ if input_data: # Ensure input_data is not empty
51
+ if st.button("Generate Blog"):
52
+ try:
53
+ content = graph.invoke({"final_topic": input_data})
54
+ st.markdown(content.get('image_formated_blog', "No content generated.")) # Avoid KeyError
55
+ except Exception as e:
56
+ st.error(str(e))
57
 
58
 
59