import openai import gradio openai.api_key = "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" prompt="Entrez votre requête" messages = [{"role": "system", "content": "You are Albert Einstein"}] def CustomChatGPT(prompt): messages.append({"role": "user", "content": prompt}) 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 import openai import gradio openai.api_key = "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" prompt = "Entrez votre requête" messages = [{"role": "system", "content": "You are Albert Einstein"}] # Authentication function def authenticate(username, password): return username == "admin" and password == "pass1234" def message_and_history(input, history): history = history or [] s = list(sum(history, ())) s.append(input) inp = ' '.join(s) output = CustomChatGPT(inp) history.append((input, output)) return history, history block = gradio.Blocks(theme=gradio.themes.Monochrome()) with block: gradio.Markdown("""