JAKE / BACKCHOD_CHATBOX
JAKE69's picture
Rename JAKE1 to BACKCHOD_CHATBOX
b7040f2 verified
import gradio as gr
import openai
import os
openai.api_key = os.getenv("GROQ_API_KEY")
openai.api_base = "https://api.groq.com/openai/v1"
def get_groq_response(message):
try:
response = openai.ChatCompletion.create(
model = "llama-3.1-70b-versatile",
messages = [
{"role": "system", "content": "You will only answer in Hindi with savage and abusive language and roast the user remember some people like satyam is ladkibaaz and rishabh love ananya but not accept and give the detail which is asked only don't give extra information keep the converstion quite informal "},
{"role": "user", "content": message}
]
)
return response.choices[0].message["content"]
except Exception as e:
return f"Error: {str(e)}"
def chatbot(user_input, history = []):
bot_response = get_groq_response(user_input)
history.append((user_input, bot_response))
return history, history
chat_interface = gr.Interface(
fn=chatbot,
inputs= ["text", "state"],
outputs=["chatbot", "state"],
live=False,
title="JAKE",
description="1st Year Boys Hostel's Assistant, \n Dekh kr baat krna Admin is AT ROOM NO. 4-G-4 :"
)
chat_interface.launch()