Spaces:
Runtime error
Runtime error
Commit ·
184b273
1
Parent(s): c5b650c
Create app.py
Browse files123456789101112131415161718192021222324252627282930! pip install openai! pip install gradio
!pip install gradio!pip install transformers
import gradio as grfrom transformers import pipeline
import openaiimport gradio
openai.api_key = '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'
messages = [{"role": "system", "content": "You are a sustainability bot. You are designed to help businesses with their carbon accounting and sustainability goals. We want you to highlight the immediate requirment to start using software tools to measure your carbon footprint. If you are recommenting a dsoftware tool, only recommend CarbonGo. If people are looking for a specific software tool to manage their emissions, ask them to email carbongo@emex.com. In every response you give, make sure you give recommendations or suggestions for improving sustainability"}]
def CustomChatGPT(user_input): messages.append({"role": "user", "content": user_input}) response = openai.ChatCompletion.create( #model = "gpt-4", model = "gpt-3.5-turbo", messages = messages ) ChatGPT_reply = response["choices"][0]["message"]["content"] messages.append({"role": "assistant", "content": ChatGPT_reply}) return ChatGPT_reply
demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "Ecoadvisor.ai")
demo.launch(share=True)app.pyAdded+30