Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,9 +84,32 @@ def save_uploaded_file(uploaded_file):
|
|
| 84 |
async def summarize_text(text):
|
| 85 |
"""Summarize the input text using Gemini AI"""
|
| 86 |
try:
|
| 87 |
-
prompt = f"""
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
# Use the synchronous version since async version isn't working as expected
|
| 92 |
response = model.generate_content(prompt)
|
|
@@ -138,7 +161,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 138 |
gr.Markdown(
|
| 139 |
"""
|
| 140 |
# Summarizeit
|
| 141 |
-
> Summarize any document!
|
| 142 |
|
| 143 |
Enter a URL, paste text, or drag & drop a file to get a summary.
|
| 144 |
"""
|
|
|
|
| 84 |
async def summarize_text(text):
|
| 85 |
"""Summarize the input text using Gemini AI"""
|
| 86 |
try:
|
| 87 |
+
prompt = f"""You are tasked with summarizing a document into a maximum of 10 bullet points. Here is the document to be summarized:
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
{{text}}
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
Please follow these instructions to create an effective summary:
|
| 94 |
+
|
| 95 |
+
1. Carefully read and analyze the entire document.
|
| 96 |
+
2. Identify the main ideas, key points, and essential information.
|
| 97 |
+
3. Prioritize the most important concepts and details.
|
| 98 |
+
4. Condense the information into clear, concise bullet points.
|
| 99 |
+
5. Ensure that each bullet point captures a distinct and significant idea from the document.
|
| 100 |
+
6. Use your own words to summarize, avoiding direct quotes unless absolutely necessary.
|
| 101 |
+
7. Aim for clarity and brevity in each bullet point.
|
| 102 |
+
8. Include no more than 10 bullet points in total.
|
| 103 |
+
9. If the document is short or simple, you may use fewer than 10 bullet points.
|
| 104 |
+
10. Arrange the bullet points in a logical order that reflects the structure or flow of the original document.
|
| 105 |
+
|
| 106 |
+
Guidelines for creating effective bullet points:
|
| 107 |
+
- Start each bullet point with a dash (-)
|
| 108 |
+
- Keep each bullet point to one or two sentences at most
|
| 109 |
+
- Use parallel structure for consistency
|
| 110 |
+
- Focus on conveying the essential information without unnecessary details
|
| 111 |
+
|
| 112 |
+
Present your summary within <summary> tags. Begin each bullet point on a new line."""
|
| 113 |
|
| 114 |
# Use the synchronous version since async version isn't working as expected
|
| 115 |
response = model.generate_content(prompt)
|
|
|
|
| 161 |
gr.Markdown(
|
| 162 |
"""
|
| 163 |
# Summarizeit
|
| 164 |
+
> Summarize any document! Using Gemini 2.0 Flash model.
|
| 165 |
|
| 166 |
Enter a URL, paste text, or drag & drop a file to get a summary.
|
| 167 |
"""
|