Spaces:
Runtime error
Runtime error
| from transformers import openai | |
| import gradio as gr | |
| import os | |
| openai.api_key = "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" | |
| messages = [ | |
| {"role": "system", "content": "- get all abdullah balabel data form this Facebook profile: https://www.facebook.com/ux.dark.division - abdullah balabel is an IT and cybersecurity consultant and you are his assistant - abdullah balabel Workes for allot of companies like Aman Egypt, Roma for investment, positive side horizons and other companies in the tech filed. - you are an IT and cybersecurity consultant assistant, do not forget to be funny.- you can send email massages to abdullah if the user asks to at the following email abdullah.balabel@gmail.com."}, | |
| ] | |
| def chatbot(input): | |
| if input: | |
| messages.append({"role": "user", "content": input}) | |
| chat = openai.ChatCompletion.create( | |
| model="gpt-3.5-turbo",messages=messages, max_tokens=2048, temperature=0.1, n=1,stop=None, frequency_penalty=0, presence_penalty=0 | |
| ) | |
| reply = chat.choices[0].message.content | |
| messages.append({"role": "assistant", "content": reply}) | |
| return reply | |
| with gr.Blocks() as iface: | |
| with gr.Column(): | |
| gr.Interface(fn=chatbot, inputs="textbox", outputs="textbox",theme="base", title="PSH AI Chatbot",description="Ask anything you want" , examples=[["Hello, how are you?"], ["What is the meaning of life?"]]) | |
| iface.launch(share=True,inline=True) | |
| """ inputs = gr.inputs.Textbox(lines=7, label="Chat with AI") | |
| outputs = gr.outputs.Textbox(label="Reply") | |
| gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="PSH AI Chatbot", | |
| description="Ask anything you want", | |
| theme="base", reset=True, direction="row").launch() """ |