| | import openai |
| | import os |
| | import gradio as gr |
| |
|
| | |
| | openai.api_key = os.environ["api"] |
| | model_engine = "text-davinci-003" |
| |
|
| | |
| | def generate_website_content(product_name, product_description): |
| | |
| | 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) |
| |
|
| | |
| | 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() |
| |
|