Fiqa commited on
Commit
5ecb8ce
·
verified ·
1 Parent(s): a1ddea8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -31,12 +31,10 @@ model.to(device)
31
  @spaces.GPU(duration=300)
32
  def generate_caption_and_image(image):
33
  img = image.convert("RGB")
34
- reader = easyocr.Reader(['en'])
35
- result = reader.readtext(img)
 
36
 
37
- # Print the extracted text
38
- for detection in result:
39
- print(f"Detected text: {detection[1]}")
40
 
41
 
42
 
@@ -46,7 +44,7 @@ def generate_caption_and_image(image):
46
  inputs = {key: val.to(device) for key, val in inputs.items()}
47
  out = model.generate(**inputs)
48
  caption = processor.decode(out[0], skip_special_tokens=True)
49
- prompt = f"Create a highly realistic design of a clothing item based on the following description: 'The design should incorporate elements from the extracted text: {result}, along with the caption: {caption}. The clothing should look realistic, modern, and stylish. Use high-quality fabric textures and realistic lighting to give the design a lifelike appearance. The colors, patterns, and materials should reflect the essence of the caption and extracted text.'"
50
 
51
 
52
  # Generate image based on the caption
 
31
  @spaces.GPU(duration=300)
32
  def generate_caption_and_image(image):
33
  img = image.convert("RGB")
34
+ # reader = easyocr.Reader(['en'])
35
+ # result = reader.readtext(img)
36
+
37
 
 
 
 
38
 
39
 
40
 
 
44
  inputs = {key: val.to(device) for key, val in inputs.items()}
45
  out = model.generate(**inputs)
46
  caption = processor.decode(out[0], skip_special_tokens=True)
47
+ prompt = f"Create a highly realistic design of a clothing item based on the following description: 'The design should incorporate elements from the extracted text: {result}. The clothing should look realistic, modern, and stylish. Use high-quality fabric textures and realistic lighting to give the design a lifelike appearance. The colors, patterns, and materials should reflect the essence of the caption and extracted text.'"
48
 
49
 
50
  # Generate image based on the caption