File size: 1,210 Bytes
7c2e367
b0420d3
7c2e367
 
 
a2fbfc2
dc0bdb5
7c2e367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c124ee
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
31
32
33
import openai
import os
import gradio as gr

# Use the openai API key
openai.api_key = os.environ["api"]
model_engine = "text-davinci-003"

# Function to generate website content based on product name and description
def generate_website_content(product_name, product_description):
    # Use the OpenAI API to generate website content
    prompt = (f"Write a full in-depth website content with mulitple sections for a product called '{product_name}'. "
              f"The product description is: '{product_description}' "
              f"The content should include proper SEO and keywords.")
    completions = openai.Completion.create(engine=model_engine, prompt=prompt, max_tokens=2048, n=1, stop=None, temperature=0.7)

    # 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()