Spaces:
Runtime error
Runtime error
nitinbhayana
commited on
Commit
•
08cf69c
1
Parent(s):
bbd82c5
Update app.py
Browse files
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 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
[INST]
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
[
|
24 |
-
|
25 |
-
[
|
26 |
-
|
27 |
-
|
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)
|