Download app.py from NETTOPIA/README: direct link, hf CLI and curl.
- Browser
- Download file 690 Bytes
-
https://huggingface.co/spaces/NETTOPIA/README/resolve/main/app.py
- Command line
-
hf download hf://spaces/NETTOPIA/README/app.py
-
curl -L -o app.py https://huggingface.co/spaces/NETTOPIA/README/resolve/main/app.py
690 Bytes
| import openai | |
| import gradio as gr | |
| # Set up OpenAI API Key (Replace with your actual API Key) | |
| openai.api_key = "YOUR_OPENAI_API_KEY" | |
| # Function to process AI commands | |
| def nettopia_ai_engine(task): | |
| response = openai.ChatCompletion.create( | |
| model="gpt-4-turbo", | |
| messages=[{"role": "system", "content": f"Automate: {task}"}] | |
| ) | |
| return response["choices"][0]["message"]["content"] | |
| # Create an interface to allow user interaction | |
| iface = gr.Interface( | |
| fn=nettopia_ai_engine, | |
| inputs="text", | |
| outputs="text", | |
| title="NETTOPIA AI Engine", | |
| description="Enter a command to automate NETTOPIA’s expansion.", | |
| ) | |
| # Launch the AI Interface | |
| iface.launch() | |