File size: 952 Bytes
908889a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
import gradio as gr
from langchain.chains import ConversationChain
from langchain.memory import ConversationBufferMemory
from langchain.llms import Groq

# Initialize the language model and memory
llm = Groq(api_key="your_groq_api_key")
memory = ConversationBufferMemory()

# Define the conversation chain
conversation = ConversationChain(llm=llm, memory=memory)

# Function to generate responses
def generate_response(user_input):
    response = conversation.run(user_input)
    return response

# Define additional inputs and examples if needed
additional_inputs = []
example1 = []

# Create the Gradio interface
interface = gr.ChatInterface(
    fn=generate_response, 
    theme="Nymbo/Alyx_Theme",
    chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
    additional_inputs=additional_inputs,
    examples=example1,
    cache_examples=False,
)

# Launch the app
interface.launch()