jzou1995 commited on
Commit
2b57935
·
verified ·
1 Parent(s): 9669a36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -76,11 +76,13 @@ Context Information: {context}
76
  NAICS Code Candidates from Google Search: {candidates}
77
 
78
  First, explain your reasoning for which industry this company belongs to.
 
 
79
  Then list 3 potential NAICS classifications with confidence percentages (must add up to 100%).
80
  Finally, provide your final conclusion.
81
 
82
  Your response should be in this format:
83
- REASONING: [Your detailed reasoning about the company's industry classification]
84
 
85
  POSSIBILITY_1: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
86
  POSSIBILITY_2: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
@@ -97,11 +99,13 @@ Company Name: {company_name}
97
  Context Information: {context}
98
 
99
  First, explain your reasoning for which industry this company belongs to.
 
 
100
  Then list 3 potential NAICS classifications with confidence percentages (must add up to 100%).
101
  Finally, provide your final conclusion.
102
 
103
  Your response should be in this format:
104
- REASONING: [Your detailed reasoning about the company's industry classification]
105
 
106
  POSSIBILITY_1: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
107
  POSSIBILITY_2: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
@@ -182,9 +186,8 @@ def find_naics_code(api_key, company_name, company_description):
182
  else:
183
  result = get_naics_classification(model, company_name, company_description, naics_candidates)
184
 
185
- # Format the output
186
- output = f"## NAICS Code for {company_name}\n\n"
187
- output += f"**NAICS Code:** {result['naics_code']}\n\n"
188
  output += f"**Reasoning:**\n{result['reasoning']}\n\n"
189
 
190
  # Add possibilities section
@@ -193,13 +196,17 @@ def find_naics_code(api_key, company_name, company_description):
193
  for i, possibility in enumerate(result['possibilities'], 1):
194
  output += f"{i}. {possibility}\n\n"
195
 
 
 
 
 
 
196
  # Add conclusion
197
  if 'conclusion' in result and result['conclusion']:
198
  output += f"**Conclusion:**\n{result['conclusion']}\n\n"
199
 
200
- if naics_candidates:
201
- output += f"**Candidate NAICS Codes Found from Google:**\n{', '.join(naics_candidates)}\n\n"
202
- output += f"*Search query used: \"{search_query}\"*"
203
 
204
  return output
205
 
 
76
  NAICS Code Candidates from Google Search: {candidates}
77
 
78
  First, explain your reasoning for which industry this company belongs to.
79
+ Start with "Based on the Google search results for this company and the provided context, I can suggest that..."
80
+
81
  Then list 3 potential NAICS classifications with confidence percentages (must add up to 100%).
82
  Finally, provide your final conclusion.
83
 
84
  Your response should be in this format:
85
+ REASONING: Based on the Google search results for this company and the provided context, I can suggest that... [Your detailed reasoning about the company's industry classification]
86
 
87
  POSSIBILITY_1: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
88
  POSSIBILITY_2: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
 
99
  Context Information: {context}
100
 
101
  First, explain your reasoning for which industry this company belongs to.
102
+ Start with "Based on the limited information available and without specific Google search results, I can suggest that..."
103
+
104
  Then list 3 potential NAICS classifications with confidence percentages (must add up to 100%).
105
  Finally, provide your final conclusion.
106
 
107
  Your response should be in this format:
108
+ REASONING: Based on the limited information available and without specific Google search results, I can suggest that... [Your detailed reasoning about the company's industry classification]
109
 
110
  POSSIBILITY_1: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
111
  POSSIBILITY_2: [Industry name] - NAICS Code [6-digit code] - [XX]% confidence
 
186
  else:
187
  result = get_naics_classification(model, company_name, company_description, naics_candidates)
188
 
189
+ # Format the output with NAICS code at the end
190
+ output = f"## Analysis for {company_name}\n\n"
 
191
  output += f"**Reasoning:**\n{result['reasoning']}\n\n"
192
 
193
  # Add possibilities section
 
196
  for i, possibility in enumerate(result['possibilities'], 1):
197
  output += f"{i}. {possibility}\n\n"
198
 
199
+ # Add Google search information
200
+ if naics_candidates:
201
+ output += f"**Candidate NAICS Codes Found from Google:**\n{', '.join(naics_candidates)}\n\n"
202
+ output += f"*Search query used: \"{search_query}\"*\n\n"
203
+
204
  # Add conclusion
205
  if 'conclusion' in result and result['conclusion']:
206
  output += f"**Conclusion:**\n{result['conclusion']}\n\n"
207
 
208
+ # Add final NAICS code at the very end
209
+ output += f"**FINAL NAICS CODE: {result['naics_code']}**"
 
210
 
211
  return output
212