Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	| import gradio as gr | |
| from transformers import pipeline | |
| pipe = pipeline("text-generation", model="shivanikerai/TinyLlama-1.1B-Chat-v1.0-seo-optimised-title-suggestion-v1.0") | |
| def my_function(keywords, product_info): | |
| B_SYS, E_SYS = "<<SYS>>", "<</SYS>>" | |
| B_INST, E_INST = "[INST]", "[/INST]" | |
| B_in, E_in = "[Product Details]", "[/Product Details]" | |
| B_out, E_out = "[Suggested Titles]", "[/Suggested Titles]" | |
| prompt = f"""{B_INST} {B_SYS} You are a helpful, respectful and honest assistant for ecommerce product title creation. {E_SYS} | |
| Create a SEO optimized e-commerce product title for the keywords:{keywords.strip()} | |
| {B_in}{product_info}{E_in}\n{E_INST}\n\n{B_out}""" | |
| predictions = pipe(prompt) | |
| output=((predictions[0]['generated_text']).split(B_out)[-1]).strip() | |
| return (output) | |
| # Process the inputs (e.g., concatenate strings, perform calculations) | |
| # result = f"You entered: {input1} and {input2}" | |
| # return result | |
| # Create the Gradio interface | |
| interface = gr.Interface(fn=my_function, | |
| inputs=["text", "text"], | |
| outputs="text", | |
| title="SEO Optimised Title Suggestion", | |
| description="Enter Keywords and Product Info:") | |
| interface.launch() | |