Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,8 +100,6 @@ st.markdown("""
|
|
| 100 |
# Display large logo at the top of the main page
|
| 101 |
st.image("https://i.postimg.cc/2j0QWF3Z/Removal-575.png", width=390)
|
| 102 |
|
| 103 |
-
# Set Streamlit app title
|
| 104 |
-
st.title("WebChatter 💬")
|
| 105 |
|
| 106 |
# Initialize session state
|
| 107 |
if "index_created" not in st.session_state:
|
|
@@ -120,7 +118,7 @@ if "embeddings" not in st.session_state:
|
|
| 120 |
# Sidebar for URL input
|
| 121 |
with st.sidebar:
|
| 122 |
st.header("Enter Web URL")
|
| 123 |
-
url = st.text_input("URL", placeholder="e.g., https://
|
| 124 |
process_url_clicked = st.button("Process URL")
|
| 125 |
|
| 126 |
# Main content container
|
|
@@ -135,7 +133,7 @@ llm = ChatGroq(
|
|
| 135 |
|
| 136 |
# Custom prompt for detailed answers
|
| 137 |
qa_prompt = PromptTemplate(
|
| 138 |
-
template="""You are an expert assistant tasked with providing detailed, extensive, and comprehensive answers. Use the provided context to answer the question thoroughly, including explanations, examples, and additional relevant information. If the context is limited, expand on the topic with your knowledge to ensure a complete response.
|
| 139 |
|
| 140 |
Context: {context}
|
| 141 |
|
|
@@ -146,7 +144,7 @@ Answer with sources: """
|
|
| 146 |
|
| 147 |
# Function to summarize URL content
|
| 148 |
def summarize_content(content, llm):
|
| 149 |
-
summary_prompt = f"""Summarize the following content in
|
| 150 |
|
| 151 |
{content}
|
| 152 |
|
|
@@ -263,7 +261,7 @@ if ask_clicked and query:
|
|
| 263 |
st.markdown(
|
| 264 |
"""
|
| 265 |
<div class="footer">
|
| 266 |
-
<img src="https://i.postimg.cc/2j0QWF3Z/Removal-575.png" width="
|
| 267 |
WebChatter © 2025 | Developed by Mahatir Ahmed Tusher
|
| 268 |
</div>
|
| 269 |
""",
|
|
|
|
| 100 |
# Display large logo at the top of the main page
|
| 101 |
st.image("https://i.postimg.cc/2j0QWF3Z/Removal-575.png", width=390)
|
| 102 |
|
|
|
|
|
|
|
| 103 |
|
| 104 |
# Initialize session state
|
| 105 |
if "index_created" not in st.session_state:
|
|
|
|
| 118 |
# Sidebar for URL input
|
| 119 |
with st.sidebar:
|
| 120 |
st.header("Enter Web URL")
|
| 121 |
+
url = st.text_input("URL", placeholder="e.g., https://mahatirtusher.com/astronomy-mythology/")
|
| 122 |
process_url_clicked = st.button("Process URL")
|
| 123 |
|
| 124 |
# Main content container
|
|
|
|
| 133 |
|
| 134 |
# Custom prompt for detailed answers
|
| 135 |
qa_prompt = PromptTemplate(
|
| 136 |
+
template="""You are an expert assistant tasked with providing detailed, extensive, and comprehensive answers. Use the provided context to answer the question thoroughly, including explanations, examples, and additional relevant information. If the context is limited, expand on the topic with your knowledge to ensure a complete response. In case of explaining anything, break the topic and explain step by step. Sometimes use your own reasing and knowledge to explain anything to the users. If the users ask any question in bengali, you too will answer it in fine and detailed bengali.
|
| 137 |
|
| 138 |
Context: {context}
|
| 139 |
|
|
|
|
| 144 |
|
| 145 |
# Function to summarize URL content
|
| 146 |
def summarize_content(content, llm):
|
| 147 |
+
summary_prompt = f"""Summarize the following content in 5-10 sentences, capturing the main points and key details in easy expression:
|
| 148 |
|
| 149 |
{content}
|
| 150 |
|
|
|
|
| 261 |
st.markdown(
|
| 262 |
"""
|
| 263 |
<div class="footer">
|
| 264 |
+
<img src="https://i.postimg.cc/2j0QWF3Z/Removal-575.png" width="80">
|
| 265 |
WebChatter © 2025 | Developed by Mahatir Ahmed Tusher
|
| 266 |
</div>
|
| 267 |
""",
|