| | import openai |
| | import os |
| | import gradio as gr |
| |
|
| | |
| | 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}"'}, |
| | ] |
| | ) |
| |
|
| | |
| | website_content = completions.choices[0].text |
| |
|
| | return website_content |
| |
|
| | |
| | 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() |
| |
|