nitinbhayana commited on
Commit
08cf69c
1 Parent(s): bbd82c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -15
app.py CHANGED
@@ -11,21 +11,25 @@ from transformers import pipeline
11
  pipeline = pipeline("text-generation", model="nitinbhayana/TinyLlama-1.1B-Chat-v1.0-title-suggestion-v1.0")
12
 
13
  def predict(title):
14
-
15
- prompt=f"""<s>[INST] <<SYS>>
16
- You are a helpful, respectful, and honest assistant for product feature mapping.
17
- <</SYS>>
18
-
19
- [INST]
20
- For a given e-commerce product title.
21
- [TITLE]
22
- {title}
23
- [/TITLE]
24
- Create a new, easy-to-read, error-free title.
25
- [/INST]
26
-
27
- Suggested Title:
28
- """
 
 
 
 
29
  predictions = pipeline(prompt)
30
  output=((predictions[0]['generated_text']).split('Suggested Title:')[-1]).strip()
31
  return (output)
 
11
  pipeline = pipeline("text-generation", model="nitinbhayana/TinyLlama-1.1B-Chat-v1.0-title-suggestion-v1.0")
12
 
13
  def predict(title):
14
+ prompt=f"""<s>[INST] <<SYS>> You are a helpful assistant that provides accurate and concise responses. <</SYS>>
15
+ Create a new, easy to read, and error free title for a given Ecommerce product title.
16
+ [Title] {title} [/Title]
17
+ [/INST]
18
+ ### Suggested Title:"""
19
+ # prompt=f"""<s>[INST] <<SYS>>
20
+ # You are a helpful, respectful, and honest assistant for product feature mapping.
21
+ # <</SYS>>
22
+
23
+ # [INST]
24
+ # For a given e-commerce product title.
25
+ # [TITLE]
26
+ # {title}
27
+ # [/TITLE]
28
+ # Create a new, easy-to-read, error-free title.
29
+ # [/INST]
30
+
31
+ # Suggested Title:
32
+ # """
33
  predictions = pipeline(prompt)
34
  output=((predictions[0]['generated_text']).split('Suggested Title:')[-1]).strip()
35
  return (output)