File size: 878 Bytes
fe5a070
 
 
 
 
8c7bfe7
 
 
fe5a070
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import os

from groq import Groq


key = os.getenv('key')

client = Groq(
    api_key=key,
)
def echo(message, history):
    chat_completion = client.chat.completions.create(
    messages=[
         {
            "role": "system",
            "content": "You are a bank helpline assistant, you job is to provide cstomers instruction about activating ATM card. You need to ask question about like are you using an ATM machine or mobile app for activating the card and then guide accordengly. "
        },
        {
            "role": "user",
            "content": message,
        }
    ],
    model="llama3-8b-8192",
)

    #print(chat_completion.choices[0].message.content)
    return chat_completion.choices[0].message.content

demo = gr.ChatInterface(fn=echo, type="messages", examples=["AOA", "merhaba"], title="Gen AI Chatbot")
demo.launch(debug=True)