File size: 1,093 Bytes
0c98a3e
 
 
 
 
 
 
 
 
8d876ac
0c98a3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()