gaur3009 commited on
Commit
041cdd0
·
verified ·
1 Parent(s): 6703e90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -7,7 +7,6 @@ import time
7
 
8
  repo = "artificialguybr/TshirtDesignRedmond-V2"
9
 
10
- # Generate design based on prompts
11
  def infer(color_prompt, phone_type_prompt, design_prompt):
12
  prompt = (
13
  f"A single vertical {color_prompt} colored {phone_type_prompt} back cover featuring a bold {design_prompt} design on the front, hanging on the plain wall. The soft light and shadows, creating a striking contrast against the minimal background, evoking modern sophistication."
@@ -42,13 +41,12 @@ def infer(color_prompt, phone_type_prompt, design_prompt):
42
  else:
43
  raise Exception(f"API Error: {response.status_code}")
44
 
45
- # Function to save the design
46
- def save_design(image):
47
  file_path = "saved_design.png"
48
  image.save(file_path)
49
  return f"Design saved as {file_path}!"
50
 
51
- # Custom CSS for animations
52
  custom_css = """
53
  body {
54
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@@ -75,7 +73,6 @@ body::before {
75
  }
76
  """
77
 
78
- # JavaScript for text-to-speech and particles
79
  custom_js = """
80
  <script>
81
  document.addEventListener('DOMContentLoaded', function () {
@@ -105,7 +102,6 @@ document.addEventListener('DOMContentLoaded', function () {
105
  </script>
106
  """
107
 
108
- # Gradio interface
109
  with gr.Blocks(css=custom_css) as interface:
110
  gr.HTML(custom_js)
111
  gr.Markdown("# **AI Phone Cover Designer**")
@@ -155,5 +151,4 @@ with gr.Blocks(css=custom_css) as interface:
155
  Start designing today and bring your creative ideas to life!
156
  """)
157
 
158
- # Launch the app
159
- interface.launch(debug=True)
 
7
 
8
  repo = "artificialguybr/TshirtDesignRedmond-V2"
9
 
 
10
  def infer(color_prompt, phone_type_prompt, design_prompt):
11
  prompt = (
12
  f"A single vertical {color_prompt} colored {phone_type_prompt} back cover featuring a bold {design_prompt} design on the front, hanging on the plain wall. The soft light and shadows, creating a striking contrast against the minimal background, evoking modern sophistication."
 
41
  else:
42
  raise Exception(f"API Error: {response.status_code}")
43
 
44
+ def save_design(image_array):
45
+ image = Image.fromarray(image_array)
46
  file_path = "saved_design.png"
47
  image.save(file_path)
48
  return f"Design saved as {file_path}!"
49
 
 
50
  custom_css = """
51
  body {
52
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
 
73
  }
74
  """
75
 
 
76
  custom_js = """
77
  <script>
78
  document.addEventListener('DOMContentLoaded', function () {
 
102
  </script>
103
  """
104
 
 
105
  with gr.Blocks(css=custom_css) as interface:
106
  gr.HTML(custom_js)
107
  gr.Markdown("# **AI Phone Cover Designer**")
 
151
  Start designing today and bring your creative ideas to life!
152
  """)
153
 
154
+ interface.launch(debug=True)