Spaces:
Runtime error
Runtime error
File size: 675 Bytes
ec5f18d 0acc588 ec5f18d 0acc588 ec5f18d 0acc588 ec5f18d 0acc588 ec5f18d 0acc588 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import gradio as gr
import openai
# Set up your OpenAI API key for GPT-3.5
openai.api_key = "YOUR_API_KEY_HERE"
# Function to interact with GPT-3.5
def interact_with_gpt(prompt):
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
max_tokens=100
)
return response.choices[0].text.strip()
# Create Gradio interface
input_text = gr.inputs.Textbox(label="Input Text")
output_text = gr.outputs.Textbox(label="Output Text")
title = "GPT-3.5 Chatbot"
description = "Enter your text, and GPT-3.5 will respond."
gr.Interface(interact_with_gpt, input_text, output_text, title=title, description=description).launch()
|