Spaces:
Runtime error
Runtime error
nitinbhayana
commited on
Commit
•
716f60f
1
Parent(s):
4c89e2f
Update app.py
Browse files
app.py
CHANGED
@@ -5,19 +5,26 @@ import gradio as gr
|
|
5 |
|
6 |
from transformers import pipeline
|
7 |
|
8 |
-
pipeline = pipeline("text-generation", model="nitinbhayana/Llama-2-7b-chat-hf-review-phrases-sentiments-v2")
|
9 |
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
-
prompt=f"""[INST] <<SYS>>
|
13 |
-
You are a helpful
|
14 |
<</SYS>>
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
[/
|
|
|
|
|
|
|
|
|
21 |
"""
|
22 |
predictions = pipeline(prompt)
|
23 |
return (predictions)
|
@@ -26,5 +33,5 @@ gr.Interface(
|
|
26 |
predict,
|
27 |
inputs='text',
|
28 |
outputs='text',
|
29 |
-
title="
|
30 |
).launch()
|
|
|
5 |
|
6 |
from transformers import pipeline
|
7 |
|
8 |
+
#pipeline = pipeline("text-generation", model="nitinbhayana/Llama-2-7b-chat-hf-review-phrases-sentiments-v2")
|
9 |
|
10 |
+
|
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 |
+
Pantene Hair Science Silky Smoth Shampo with Pro-Vitamins & Vitamin E, shampoo for woman & men, shampoo for frizzy and dry hairs, 650ml
|
23 |
+
[/TITLE]
|
24 |
+
Create a new, easy-to-read, error-free title.
|
25 |
+
[/INST]
|
26 |
+
|
27 |
+
Suggested Title:
|
28 |
"""
|
29 |
predictions = pipeline(prompt)
|
30 |
return (predictions)
|
|
|
33 |
predict,
|
34 |
inputs='text',
|
35 |
outputs='text',
|
36 |
+
title="Title Suggestion",
|
37 |
).launch()
|