cryogenic22 commited on
Commit
9748931
·
verified ·
1 Parent(s): 7d6dd45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -385,15 +385,15 @@ def run_market_research(topic: str, progress_container, chat_container):
385
  "sources": []
386
  }
387
 
388
-
389
  def extract_section(text, section_name):
390
  """Extract a section from the text"""
391
- pattern = f"{section_name}.*?\n(.*?)(?=\n\n|<span class="math-inline">\)"
392
- match \= re\.search\(pattern, text, re\.DOTALL \| re\.IGNORECASE\)
393
- return match\.group\(1\)\.strip\(\) if match else ""
394
- def extract\_sources\(text\)\:
395
- """Extract sources from the text"""
396
- source\_pattern \= r"Source\:\.\*?\(?\:\\n\|</span>)|\[.*?\]|\(https?://.*?\)"
 
397
  matches = re.finditer(source_pattern, text, re.MULTILINE)
398
  return [match.group().strip() for match in matches]
399
 
 
385
  "sources": []
386
  }
387
 
 
388
  def extract_section(text, section_name):
389
  """Extract a section from the text"""
390
+ pattern = rf"{section_name}.*?\n(.*?)(?=\n\n|<span class=\"math-inline\">)"
391
+ match = re.search(pattern, text, re.DOTALL | re.IGNORECASE)
392
+ return match.group(1).strip() if match else ""
393
+
394
+ def extract_sources(text):
395
+ """Extract sources from the text"""
396
+ source_pattern = r"Source:.*?(?:\n|<span class=\"math-inline\">)|\[.*?\]|\(https?://.*?\)"
397
  matches = re.finditer(source_pattern, text, re.MULTILINE)
398
  return [match.group().strip() for match in matches]
399