Spaces:
Build error
Build error
Commit ·
8dd9bc7
1
Parent(s): a3dee51
Add application file
Browse files1234567import gradio as grdef greet(name):return "Hello " + name + "!!"iface = gr.Interface(fn=greet, inputs="text", outputs="text")iface.launch()1234567891011121314151617181920212223242526272829303132333435import gradio as grimport openaiimport osopenai.api_key = os.getenv("api_key")def run_ai(name, words):name = name.lower()if name == 'mauldin':testing = openai.ChatCompletion.create(model="gpt-3.5-turbo",messages=[{"role": "user", "content": "You are a public relations consultant that works woth companies to get articles published for them. Your current task is to draft an email about the company or product that will be used to email editors at large news publications."},{"role": "user", "content": "The action you are asking is for an article to be created and published on a new release."},{"role": "user", "content": "I will be adding information that is relevent. Can you aggregate this information into an email to sent?"},{"role": "user", "content": words},{"role": "user", "content": "Draft email."}])return testing['choices'][0]['message']['content']else:return "You are not JUSTIN!!!"demo = gr.Interface(fn=run_ai,inputs=[gr.Textbox(label="Last Name"), gr.Textbox(lines=2, label="A bunch of words about your product.")],outputs=["text"],)demo.launch()
app.py+32-4