Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -159,7 +159,19 @@ def generate_response(prompt, max_new_tokens=256):
|
|
159 |
# Check if model is loaded properly
|
160 |
if 'model' not in globals() or model is None:
|
161 |
print("Model not available for generation")
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
try:
|
165 |
# For T5 models
|
|
|
159 |
# Check if model is loaded properly
|
160 |
if 'model' not in globals() or model is None:
|
161 |
print("Model not available for generation")
|
162 |
+
response = f"Based on the search results for '{query}', I can provide the following information:\n\n"
|
163 |
+
# Extract key information from search results
|
164 |
+
for i, result in enumerate(search_results[:3], 1):
|
165 |
+
# Add a section for each source with actual content
|
166 |
+
title = result['title'].replace("Wikipedia - ", "")
|
167 |
+
content = result['snippet']
|
168 |
+
|
169 |
+
response += f"**{title}**: {content} [{i}]\n\n"
|
170 |
+
|
171 |
+
# Add a conclusion
|
172 |
+
response += f"These sources provide information about {query} from different perspectives. For more detailed information, you can explore the full sources listed below."
|
173 |
+
|
174 |
+
return response
|
175 |
|
176 |
try:
|
177 |
# For T5 models
|