requirements.txt
Browse filesopenai
gradio
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Set up OpenAI API Key (Replace with your actual API Key)
|
| 5 |
+
openai.api_key = "YOUR_OPENAI_API_KEY"
|
| 6 |
+
|
| 7 |
+
# Function to process AI commands
|
| 8 |
+
def nettopia_ai_engine(task):
|
| 9 |
+
response = openai.ChatCompletion.create(
|
| 10 |
+
model="gpt-4-turbo",
|
| 11 |
+
messages=[{"role": "system", "content": f"Automate: {task}"}]
|
| 12 |
+
)
|
| 13 |
+
return response["choices"][0]["message"]["content"]
|
| 14 |
+
|
| 15 |
+
# Create an interface to allow user interaction
|
| 16 |
+
iface = gr.Interface(
|
| 17 |
+
fn=nettopia_ai_engine,
|
| 18 |
+
inputs="text",
|
| 19 |
+
outputs="text",
|
| 20 |
+
title="NETTOPIA AI Engine",
|
| 21 |
+
description="Enter a command to automate NETTOPIA’s expansion.",
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
# Launch the AI Interface
|
| 25 |
+
iface.launch()
|