Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from diffusers import DiffusionPipeline
|
|
| 8 |
import torch
|
| 9 |
import spaces # Hugging Face Spaces module
|
| 10 |
|
|
|
|
| 11 |
import requests
|
| 12 |
|
| 13 |
|
|
@@ -45,7 +46,11 @@ def generate_caption_and_image(image):
|
|
| 45 |
# reader = easyocr.Reader(['en'])
|
| 46 |
# result = reader.readtext(img)
|
| 47 |
import random
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
# Define lists for the three variables
|
| 51 |
fabrics = ['cotton', 'silk', 'denim', 'linen', 'polyester', 'wool', 'velvet']
|
|
@@ -71,7 +76,7 @@ def generate_caption_and_image(image):
|
|
| 71 |
out = model.generate(**inputs)
|
| 72 |
caption1 = processor.decode(out[0], skip_special_tokens=True)
|
| 73 |
|
| 74 |
-
prompt = f'''Create a highly realistic clothing item based on the following descriptions: The design should reflect {caption1} and {caption2}, blending both themes into a single, stylish, and modern piece of clothing. Incorporate highly realistic and high-quality textures that exude sophistication, with realistic fabric lighting and fine details. Subtly hint at {selected_fabric}, featuring a {selected_pattern} motif and a {selected_textile_design} style that harmoniously balances the essence of both captions.'''
|
| 75 |
|
| 76 |
|
| 77 |
|
|
|
|
| 8 |
import torch
|
| 9 |
import spaces # Hugging Face Spaces module
|
| 10 |
|
| 11 |
+
import easyocr
|
| 12 |
import requests
|
| 13 |
|
| 14 |
|
|
|
|
| 46 |
# reader = easyocr.Reader(['en'])
|
| 47 |
# result = reader.readtext(img)
|
| 48 |
import random
|
| 49 |
+
reader = easyocr.Reader(['ur', 'eng'])
|
| 50 |
+
|
| 51 |
+
# Read text from an image
|
| 52 |
+
result = reader.readtext(img)
|
| 53 |
+
|
| 54 |
|
| 55 |
# Define lists for the three variables
|
| 56 |
fabrics = ['cotton', 'silk', 'denim', 'linen', 'polyester', 'wool', 'velvet']
|
|
|
|
| 76 |
out = model.generate(**inputs)
|
| 77 |
caption1 = processor.decode(out[0], skip_special_tokens=True)
|
| 78 |
|
| 79 |
+
prompt = f'''Create a highly realistic clothing item based on the following descriptions: The design should reflect {caption1} and {caption2}, blending both themes into a single, stylish, and modern piece of clothing. Incorporate highly realistic and high-quality textures that exude sophistication, with realistic fabric lighting and fine details. Subtly hint at {selected_fabric}, featuring a {selected_pattern} motif and a {selected_textile_design} style that harmoniously balances the essence of both captions.and {result} should be written on top of it'''
|
| 80 |
|
| 81 |
|
| 82 |
|