Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ logger = logging.getLogger(__name__)
|
|
18 |
|
19 |
# Constants
|
20 |
EMBEDDING_MODEL = 'sentence-transformers/all-MiniLM-L6-v2'
|
21 |
-
DEFAULT_MODEL = "
|
22 |
|
23 |
@st.cache_resource
|
24 |
def load_embeddings():
|
@@ -71,44 +71,35 @@ def summarize_report(documents: List[Document], llm) -> str:
|
|
71 |
"""Summarize the report using the loaded model."""
|
72 |
try:
|
73 |
prompt_template = """
|
74 |
-
You are an AI
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
π Key funding mechanisms (e.g., grants, loans, public-private partnerships)
|
104 |
-
π Innovative financing approaches
|
105 |
-
|
106 |
-
π΄ Progress and Significance:
|
107 |
-
π Key achievements or milestones
|
108 |
-
π [1-2 concluding points about [FOCUS_REGION]'s role or significance in [TOPIC]]
|
109 |
-
|
110 |
-
Please ensure the summary is concise, informative, and easy to read at a glance. Use precise figures where available and highlight any significant financial trends or insights. The summary should provide a comprehensive overview of both the financial aspects and the broader context of [TOPIC] in [FOCUS_REGION].
|
111 |
-
"""
|
112 |
|
113 |
prompt = PromptTemplate.from_template(prompt_template)
|
114 |
chain = load_summarize_chain(llm, chain_type="stuff", prompt=prompt)
|
|
|
18 |
|
19 |
# Constants
|
20 |
EMBEDDING_MODEL = 'sentence-transformers/all-MiniLM-L6-v2'
|
21 |
+
DEFAULT_MODEL = "liuhaotian/llava-v1.6-mistral-7b"
|
22 |
|
23 |
@st.cache_resource
|
24 |
def load_embeddings():
|
|
|
71 |
"""Summarize the report using the loaded model."""
|
72 |
try:
|
73 |
prompt_template = """
|
74 |
+
<s>[INST] You are an advanced AI assistant with expertise in summarizing technical documents. Your goal is to create a clear, concise, and well-organized summary using Markdown formatting. Focus on extracting and presenting the essential points of the document effectively.
|
75 |
+
|
76 |
+
*Instructions:*
|
77 |
+
- Analyze the provided context and input carefully.
|
78 |
+
- Identify and highlight the key points, main arguments, and important details.
|
79 |
+
- Format the summary using Markdown for clarity:
|
80 |
+
- Use # for main headers and ## for subheaders.
|
81 |
+
- Use **text** for important terms or concepts.
|
82 |
+
- Provide a brief introduction, followed by the main points, and a concluding summary if applicable.
|
83 |
+
- Ensure the summary is easy to read and understand, avoiding unnecessary jargon.
|
84 |
+
|
85 |
+
*Example Summary Format:*
|
86 |
+
|
87 |
+
# Overview
|
88 |
+
*Document Title:* Technical Analysis Report
|
89 |
+
|
90 |
+
*Summary:*
|
91 |
+
The report provides an in-depth analysis of the recent technical advancements in AI. It covers key areas such as ...
|
92 |
+
|
93 |
+
# Key Findings
|
94 |
+
- *Finding 1:* Description of finding 1.
|
95 |
+
- *Finding 2:* Description of finding 2.
|
96 |
+
|
97 |
+
# Conclusion
|
98 |
+
The analysis highlights the significant advancements and future directions for AI technology.
|
99 |
+
|
100 |
+
*Your Response:* [/INST]</s> {input}
|
101 |
+
Context: {context}
|
102 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
prompt = PromptTemplate.from_template(prompt_template)
|
105 |
chain = load_summarize_chain(llm, chain_type="stuff", prompt=prompt)
|