nitinbhayana's picture
Update app.py
142ce09
raw
history blame contribute delete
No virus
1.63 kB
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()