Spaces:
Runtime error
Runtime error
Download app.py from Storyblade/ORACLE: direct link, hf CLI and curl.
- Browser
- Download file 662 Bytes
-
https://huggingface.co/spaces/Storyblade/ORACLE/resolve/main/app.py
- Command line
-
hf download hf://spaces/Storyblade/ORACLE/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Storyblade/ORACLE/resolve/main/app.py
662 Bytes
| import gradio as gr | |
| import openai | |
| openai.api_key = "your_openai_api_key" | |
| def chatbot_response(user_input): | |
| response = openai.ChatCompletion.create( | |
| model="gpt-3.5-turbo", | |
| messages=[{"role": "system", "content": "You are a helpful AI assistant."}, | |
| {"role": "user", "content": user_input}] | |
| ) | |
| return response["choices"][0]["message"]["content"] | |
| iface = gr.Interface(fn=chatbot_response, | |
| inputs="text", | |
| outputs="text", | |
| title="AI Chatbot", | |
| description="A simple AI chatbot running on Hugging Face Spaces.") | |
| iface.launch() |