Spaces:
Runtime error
Runtime error
import gradio | |
from transformers import pipeline | |
import openai | |
import gradio | |
openai.api_key = "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" | |
messages = [{"role": "system", "content": "You are a Indian Lawyer and Gave Advice according to Indian constitution"}] | |
def CustomChatGPT(user_input): | |
messages.append({"role": "user", "content": user_input}) | |
response = openai.ChatCompletion.create( | |
model = "gpt-3.5-turbo", | |
messages = messages | |
) | |
ChatGPT_reply = response["choices"][0]["message"]["content"] | |
messages.append({"role": "assistant", "content": ChatGPT_reply}) | |
return ChatGPT_reply | |
iface = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "AI Chat Bot for Legal Assistance This is Free version and if it doesnt work kindly contact at Email ID contact2abhaygupta@gmail.com") | |
print(" This is Free version and if it doesnt work kindly contact at Email ID contact2abhaygupta@gmail.com") | |
iface.launch(inline=False) | |