broadfield-dev commited on
Commit
bcab8fb
·
verified ·
1 Parent(s): 01e92ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -18,21 +18,14 @@ def get_webpage_text(url):
18
  return rawp
19
  else:
20
  return "ERROR couldn't find, "+url
21
- def generate_image(prompt):
22
- client = InferenceClient("black-forest-labs/FLUX.1-dev")
23
- response = client.text_to_image(prompt)
24
- return response
25
 
26
-
27
- def generate_prompt(company_name, company_url=""):
28
-
29
  client = InferenceClient(model_name)
30
- company_html = get_webpage_text(company_url)
31
-
32
  system_prompt=f"""You are a Master Generative Image Prompt Writer, you know just the perfect prompt secrets for every situation
33
  Today you will be generating Company Logo's
34
- You will be given a Company Name, and HTML artifacts from their website, use this to generate a sufficiently long and detailed image generation prompt to satisfy the users request, make sure that the company name is the focal point of the image
35
  Company Name: {company_name}
 
36
  HTML from Company Website: {company_html}"""
37
  prompt_in=[
38
  {'role':'system','content':system_prompt},
@@ -43,19 +36,27 @@ def generate_prompt(company_name, company_url=""):
43
  output += response.token.text
44
  return output
45
 
 
 
 
 
 
 
 
 
46
  # Create Gradio Interface
47
  with gr.Blocks() as demo:
48
  gr.Markdown("## Smart Logo Maker")
49
  with gr.Row():
50
  with gr.Column():
51
- model_dropdown = gr.Dropdown(models, label="Select Model")
52
- prompt_input = gr.Textbox(label="Enter Company Name")
53
- prompt_input = gr.Textbox(label="Enter Company Name")
54
  generate_button = gr.Button("Generate Image")
55
  with gr.Column():
56
  output_image = gr.Image(label="Generated Image")
57
 
58
- generate_button.click(generate_image, inputs=[prompt_input, model_dropdown], outputs=output_image)
59
 
60
  # Launch the interface
61
  demo.launch()
 
18
  return rawp
19
  else:
20
  return "ERROR couldn't find, "+url
 
 
 
 
21
 
22
+ def generate_prompt(company_name, company_html, company_descp):
 
 
23
  client = InferenceClient(model_name)
 
 
24
  system_prompt=f"""You are a Master Generative Image Prompt Writer, you know just the perfect prompt secrets for every situation
25
  Today you will be generating Company Logo's
26
+ You will be given a Company Name, Description, and HTML artifacts from their website, use this to generate a sufficiently long and detailed image generation prompt to satisfy the users request, make sure that the company name is the focal point of the image
27
  Company Name: {company_name}
28
+ Company Description: {company_descp}
29
  HTML from Company Website: {company_html}"""
30
  prompt_in=[
31
  {'role':'system','content':system_prompt},
 
36
  output += response.token.text
37
  return output
38
 
39
+
40
+ def generate_image(comp_name, comp_desc, comp_url):
41
+ web_out=get_webpage_text(comp_url)
42
+ prompt_out=generate_prompt(comp_name,web_out, comp_desc)
43
+ client = InferenceClient("black-forest-labs/FLUX.1-dev")
44
+ response = client.text_to_image(prompt)
45
+ return response
46
+
47
  # Create Gradio Interface
48
  with gr.Blocks() as demo:
49
  gr.Markdown("## Smart Logo Maker")
50
  with gr.Row():
51
  with gr.Column():
52
+ comp_name = gr.Textbox(label="Enter Company Name")
53
+ comp_desc = gr.Textbox(label="Enter Company Description (optional)")
54
+ comp_url = gr.Textbox(label="Enter Company URL (optional)")
55
  generate_button = gr.Button("Generate Image")
56
  with gr.Column():
57
  output_image = gr.Image(label="Generated Image")
58
 
59
+ generate_button.click(generate_image, inputs=[comp_name, comp_desc, comp_url], outputs=output_image)
60
 
61
  # Launch the interface
62
  demo.launch()