Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -136,6 +136,10 @@ def process_article_for_summary(text, images=[], compression_percentage=30):
|
|
| 136 |
In clear and concise language, summarize the key points and themes presented in the article by cutting it by {compression_percentage} percent in the markdown format.
|
| 137 |
|
| 138 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
message_content = [{"type": "text", "text": prompt}] + images
|
| 140 |
response = client_3.chat.complete(
|
| 141 |
model="pixtral-12b-2409",
|
|
@@ -146,6 +150,10 @@ def process_article_for_summary(text, images=[], compression_percentage=30):
|
|
| 146 |
# Question answering function
|
| 147 |
def ask_question_to_mistral(text, question, images=[]):
|
| 148 |
prompt = f"Answer the following question without mentioning it or repeating the original text on which the question is asked in style markdown.IN RUSSIAN:\nQuestion: {question}\n\nText:\n{text}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
message_content = [{"type": "text", "text": prompt}] + images
|
| 150 |
search_tool, tool = setup_search(question)
|
| 151 |
context = ''
|
|
|
|
| 136 |
In clear and concise language, summarize the key points and themes presented in the article by cutting it by {compression_percentage} percent in the markdown format.
|
| 137 |
|
| 138 |
"""
|
| 139 |
+
|
| 140 |
+
if len(images) >= 8 :
|
| 141 |
+
images = images[:7]
|
| 142 |
+
|
| 143 |
message_content = [{"type": "text", "text": prompt}] + images
|
| 144 |
response = client_3.chat.complete(
|
| 145 |
model="pixtral-12b-2409",
|
|
|
|
| 150 |
# Question answering function
|
| 151 |
def ask_question_to_mistral(text, question, images=[]):
|
| 152 |
prompt = f"Answer the following question without mentioning it or repeating the original text on which the question is asked in style markdown.IN RUSSIAN:\nQuestion: {question}\n\nText:\n{text}"
|
| 153 |
+
|
| 154 |
+
if len(images) >= 8 :
|
| 155 |
+
images = images[:7]
|
| 156 |
+
|
| 157 |
message_content = [{"type": "text", "text": prompt}] + images
|
| 158 |
search_tool, tool = setup_search(question)
|
| 159 |
context = ''
|