alpcansoydas commited on
Commit
495b6d0
1 Parent(s): 512f3d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -14,18 +14,19 @@ llm = HuggingFaceEndpoint(
14
  )
15
 
16
  template_classify = '''
17
- You are an irrelevant text detector bot.
18
- In social media, there are lots of bot accounts or real people and they produce irrelevant/non-related text about company and its services.
19
  You will be provided company informations such as company name, company sector and information about company.
20
  Using this informations about company, think about its services and sector, if given text is relevant to the company classify it as RELEVANT,
21
- if the given text is not relevant to the company classify it as IRRELEVANT
22
 
23
  Provided information:
 
24
  Company name: {COMPANY_NAME}
25
  Company sector: {COMPANY_SECTOR}
26
  About Company: {ABOUT_COMPANY}
 
27
 
28
- Detect following text as RELEVANT OR IRRELEVANT based on Company Name, Company Sector, About Company:
29
 
30
  <text>
31
  {TEXT}
@@ -49,11 +50,13 @@ def classify_text(text, company_name_input, company_sector_input, about_company_
49
  template=template_classify,
50
  input_variables=["TEXT", "COMPANY_NAME", "COMPANY_SECTOR", "ABOUT_COMPANY"]
51
  )
 
52
  formatted_prompt = prompt_classify.format(TEXT=text,
53
  COMPANY_NAME=company_name_input,
54
  COMPANY_SECTOR=company_sector_input,
55
  ABOUT_COMPANY=about_company_input
56
  )
 
57
  classify = llm.invoke(formatted_prompt)
58
  parsed_output = json_output_parser.parse(classify)
59
  end = time.time()
 
14
  )
15
 
16
  template_classify = '''
17
+ You are an twitter irrelevant text detector.
 
18
  You will be provided company informations such as company name, company sector and information about company.
19
  Using this informations about company, think about its services and sector, if given text is relevant to the company classify it as RELEVANT,
20
+ if the given text is not relevant to the company classify it as IRRELEVANT.
21
 
22
  Provided information:
23
+ [
24
  Company name: {COMPANY_NAME}
25
  Company sector: {COMPANY_SECTOR}
26
  About Company: {ABOUT_COMPANY}
27
+ ]
28
 
29
+ Detect following text as RELEVANT OR IRRELEVANT based provided information:
30
 
31
  <text>
32
  {TEXT}
 
50
  template=template_classify,
51
  input_variables=["TEXT", "COMPANY_NAME", "COMPANY_SECTOR", "ABOUT_COMPANY"]
52
  )
53
+
54
  formatted_prompt = prompt_classify.format(TEXT=text,
55
  COMPANY_NAME=company_name_input,
56
  COMPANY_SECTOR=company_sector_input,
57
  ABOUT_COMPANY=about_company_input
58
  )
59
+ print(formatted_prompt, flush=True)
60
  classify = llm.invoke(formatted_prompt)
61
  parsed_output = json_output_parser.parse(classify)
62
  end = time.time()