Spaces:
Sleeping
Sleeping
import gradio as gr | |
import logging | |
import uuid | |
from dotenv import load_dotenv | |
load_dotenv(override=True) | |
from langhcain_agent import llm_inference | |
def predict_interface(message, history=None, user_id = None): | |
response = llm_inference(message, history, user_id) | |
logging.error(response) | |
logging.error(user_id) | |
return response['output'] | |
session_id = gr.Textbox(value = str(uuid.uuid4()), type = "text", label = "session_id") | |
example_sentences=["Recommend me something in Quentin Tarantino reggae style", "Give me songs with calm and relaxing vibes", "I want to listen to something like the movie Inception", "I want music that sounds like Lebron James eating soup"] | |
examples = [[example, f"user_{i}"] for i, example in enumerate(example_sentences)] | |
chat = gr.ChatInterface( | |
predict_interface, | |
additional_inputs= [session_id], | |
chatbot=gr.Chatbot(height=600), | |
textbox=gr.Textbox(placeholder="Ask me for music recommendations!", container=False, scale=7), | |
description="This AI makes song recommendations based on your music style.", | |
examples=examples, | |
title="Persona Music song recommender", | |
retry_btn="Retry", | |
clear_btn="Clear", | |
undo_btn = None | |
) | |
chat.queue().launch() | |