Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,13 +133,13 @@ def generate_summary(text):
|
|
| 133 |
text = text[:15000]
|
| 134 |
try:
|
| 135 |
completion = groq_client.chat.completions.create(
|
| 136 |
-
model="
|
| 137 |
messages=[
|
| 138 |
-
{"role": "system", "content": "You are a helpful assistant
|
| 139 |
{"role": "user", "content": f"Please summarize the following political manifesto text in about 300-500 words, focusing on the main policy areas, promises, and themes:\n{text}"}
|
| 140 |
],
|
| 141 |
temperature=0.3,
|
| 142 |
-
max_tokens=
|
| 143 |
)
|
| 144 |
return completion.choices[0].message.content
|
| 145 |
except Exception as e:
|
|
@@ -181,7 +181,7 @@ Relevant Information:
|
|
| 181 |
|
| 182 |
try:
|
| 183 |
completion = groq_client_instance.chat.completions.create(
|
| 184 |
-
model="
|
| 185 |
messages=[
|
| 186 |
{"role": "system", "content": "You are a helpful assistant skilled at analyzing political texts and extracting relevant information based on a search query. Provide clear, concise summaries."},
|
| 187 |
{"role": "user", "content": prompt}
|
|
|
|
| 133 |
text = text[:15000]
|
| 134 |
try:
|
| 135 |
completion = groq_client.chat.completions.create(
|
| 136 |
+
model="meta-llama/llama-4-maverick-17b-128e-instruct", # Or your preferred model
|
| 137 |
messages=[
|
| 138 |
+
{"role": "system", "content": "You are a helpful assistant who summarizes political manifestos. Provide a concise, objective summary that captures the key policy proposals, themes, and promises in the manifesto."},
|
| 139 |
{"role": "user", "content": f"Please summarize the following political manifesto text in about 300-500 words, focusing on the main policy areas, promises, and themes:\n{text}"}
|
| 140 |
],
|
| 141 |
temperature=0.3,
|
| 142 |
+
max_tokens=900
|
| 143 |
)
|
| 144 |
return completion.choices[0].message.content
|
| 145 |
except Exception as e:
|
|
|
|
| 181 |
|
| 182 |
try:
|
| 183 |
completion = groq_client_instance.chat.completions.create(
|
| 184 |
+
model="meta-llama/llama-4-maverick-17b-128e-instruct", # Use the same or a suitable model
|
| 185 |
messages=[
|
| 186 |
{"role": "system", "content": "You are a helpful assistant skilled at analyzing political texts and extracting relevant information based on a search query. Provide clear, concise summaries."},
|
| 187 |
{"role": "user", "content": prompt}
|