import openai import os import gradio as gr # Use the openai API key openai.api_key = os.environ["api"] openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": 'You are a website content generator that provides detailed website content with multiple sections based on the "{product_name}" and "{product_description}" with keywords of the websites'}, {"role": "user", "content": 'You are a website content generator that provides detailed website content with multiple sections based on the "{product_name}" and "{product_description}"'}, ] ) # Get the generated website content website_content = completions.choices[0].text return website_content # Create the Gradio interface input_components = [ gr.inputs.Textbox(label="Brand Name"), gr.inputs.Textbox(lines=5, label="Brand Description") ] output_components = [ gr.outputs.Textbox(label="Website Content") ] gr.Interface(fn=generate_website_content, inputs=input_components, outputs=output_components, title="Website Content Generator", ).launch()