Kathirsci commited on
Commit
cdde9f4
Β·
verified Β·
1 Parent(s): 586e9cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -34,7 +34,7 @@ def load_embeddings():
34
  def load_llm(model_name):
35
  """Load and cache the language model."""
36
  try:
37
- pipe = pipeline("text2text-generation", model=model_name, max_length=512)
38
  return HuggingFacePipeline(pipeline=pipe)
39
  except Exception as e:
40
  logger.error(f"Failed to load LLM: {e}")
@@ -77,29 +77,36 @@ def summarize_report(documents: List[Document], llm) -> str:
77
  Your summary should follow this structure:
78
  Summary:
79
  πŸ’° [TOPIC] Overview for [FOCUS_REGION]:
 
80
  πŸ”΄ [FOCUS_REGION]'s Position in Global [TOPIC]:
81
  πŸ“ Total investment/funding: [amount]
82
  πŸ“ Breakdown of funding sources (e.g., government, private sector)
83
  πŸ“ [FOCUS_REGION]'s ranking in global investment
84
  πŸ“ Key statistics and figures
 
85
  πŸ”΄ Financial Impact and Projections:
86
  πŸ“ Expected ROI or economic benefits
87
  πŸ“ Financial milestones or targets
88
  πŸ“ Impact on relevant areas
 
89
  πŸ”΄ Global Comparison:
90
  πŸ“ [List of relevant countries/regions with their financial figures]
91
  πŸ“ Comparative analysis of [FOCUS_REGION] vs other major players
 
92
  πŸ”΄ Budget Analysis:
93
  πŸ“ Major budget items
94
  πŸ“ Key budget allocations
95
  πŸ“ Year-over-year budget changes
96
  πŸ“ Comparison to industry benchmarks
 
97
  πŸ”΄ Funding Strategies:
98
  πŸ“ Key funding mechanisms (e.g., grants, loans, public-private partnerships)
99
  πŸ“ Innovative financing approaches
 
100
  πŸ”΄ Progress and Significance:
101
  πŸ“ Key achievements or milestones
102
  πŸ“ [1-2 concluding points about [FOCUS_REGION]'s role or significance in [TOPIC]]
 
103
  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].
104
  """
105
 
 
34
  def load_llm(model_name):
35
  """Load and cache the language model."""
36
  try:
37
+ pipe = pipeline("text2text-generation", model=model_name, max_length=1024)
38
  return HuggingFacePipeline(pipeline=pipe)
39
  except Exception as e:
40
  logger.error(f"Failed to load LLM: {e}")
 
77
  Your summary should follow this structure:
78
  Summary:
79
  πŸ’° [TOPIC] Overview for [FOCUS_REGION]:
80
+
81
  πŸ”΄ [FOCUS_REGION]'s Position in Global [TOPIC]:
82
  πŸ“ Total investment/funding: [amount]
83
  πŸ“ Breakdown of funding sources (e.g., government, private sector)
84
  πŸ“ [FOCUS_REGION]'s ranking in global investment
85
  πŸ“ Key statistics and figures
86
+
87
  πŸ”΄ Financial Impact and Projections:
88
  πŸ“ Expected ROI or economic benefits
89
  πŸ“ Financial milestones or targets
90
  πŸ“ Impact on relevant areas
91
+
92
  πŸ”΄ Global Comparison:
93
  πŸ“ [List of relevant countries/regions with their financial figures]
94
  πŸ“ Comparative analysis of [FOCUS_REGION] vs other major players
95
+
96
  πŸ”΄ Budget Analysis:
97
  πŸ“ Major budget items
98
  πŸ“ Key budget allocations
99
  πŸ“ Year-over-year budget changes
100
  πŸ“ Comparison to industry benchmarks
101
+
102
  πŸ”΄ Funding Strategies:
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