Spaces:
Runtime error
Runtime error
File size: 647 Bytes
a7247a1 54bc020 a7247a1 54bc020 a7247a1 54bc020 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import gradio as gr
# Create a text input
text_input = gr.inputs.Textbox(lines=2, label="Enter your text:")
# Create a text output
text_output = gr.outputs.Textbox(label="ChatGPT Output:")
# Create a button
button = gr.inputs.Button(label="Submit")
# Create a form
form = gr.Interface(
text_input,
button,
text_output,
title="ChatGPT",
description="Chat with a GPT-3 model"
)
# Define the function that will be called when the button is clicked
def process_input(values):
text = values["text_input"]
response = chatgpt.chat(text)
return {"text_output": response}
# Launch the form
form.launch(process_input) |