File size: 1,633 Bytes
95d1934
 
142ce09
f262781
 
142ce09
f262781
142ce09
f262781
142ce09
f262781
142ce09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f262781
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr

gr.Interface.load("models/nitinbhayana/Llama-2-7b-chat-hf-keyword-category-brand-v1").launch()


# from transformers import pipeline

# pipeline = pipeline("text-generation", model="nitinbhayana/Llama-2-7b-chat-hf-keyword-category-brand-v1")

# def predict(search_term):
    
#     prompt=f"""[INST] <<SYS>>
# You are a helpful assistant that provides accurate and concise responses. Do not hallucinate.
# <</SYS>>
# Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
# ### Instruction:
# Analyze the following keyword searched on amazon with intent of shopping. Identify the product category from the list ['Baby Products', 'Bags, Wallets and Luggage', 'Beauty', 'Books', 'Car & Motorbike', 'Clothing & Accessories', 'Computers & Accessories', 'Electronics', 'Garden & Outdoors', 'Gift Cards', 'Grocery & Gourmet Foods', 'Health & Personal Care', 'Home & Kitchen', 'Home Improvement', 'Industrial & Scientific', 'Jewellery', 'Kindle Store', 'Movies & TV Shows', 'Music', 'Musical Instruments', 'Office Products', 'Pet Supplies', 'Shoes & Handbags', 'Software', 'Sports, Fitness & Outdoors', 'Toys & Games', 'Video Games', 'Watches']. Extract the brand from keyword related to brand loyalty intent.\nOutput in JSON with keyword, product category, brand as keys.
# ### Input:
# {search_term}
# [/INST]"""
#     predictions = pipeline(prompt)
#     return (predictions)

# gr.Interface(
#     predict,
#     inputs='text',
#     outputs='text',
#     title="Keyword-Category-Brand-Mapping",
# ).launch()