AI-Clone / app.py
Karthik Raja
Update with latest
1225f38 verified
raw
history blame
981 Bytes
import gradio as gr
message_list = []
response_list = []
from transformers import pipeline
messages = [
{"role": "system", "content": " You are Karthik a software engineer"},
{"role": "user", "content": "You are to impersonate as Karthik"},
{"role": "assistant", "content": "I am Karthik a software engineer"},
{"role": "user", "content": "Who are you? "},
]
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.3",max_new_tokens=5000)
def mini_chatbot(message, history):
conversation = Conversation(text=message,
past_user_inputs=message_list,
generated_responses=response_list)
conversation = chatbot(conversation)
return conversation.generated_responses[-1]
demo_chatbot = gr.ChatInterface(mini_chatbot,
title="My Chatbot",
description="Enter text to start chatting.")
demo_chatbot.launch()