diamantrsd commited on
Commit
db0625e
1 Parent(s): f3adc39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -5,10 +5,10 @@ import numpy as np
5
  from tensorflow.image import resize
6
 
7
  # Load the image classification model
8
- image_classification_model = tf.keras.models.load_model("mobilenetfashion.h5")
9
 
10
  # Load pre-trained GPT-2 model and tokenizer
11
- gpt2_model_name = "diamantrsd/copywriting-otomatis-v1"
12
  gpt2_model = GPT2LMHeadModel.from_pretrained(gpt2_model_name)
13
  gpt2_tokenizer = GPT2Tokenizer.from_pretrained(gpt2_model_name)
14
 
@@ -35,13 +35,9 @@ def classify_and_generate_text(image, keywords=""):
35
 
36
  def map_class_label_to_category(class_label):
37
  # Map the class label to a category (replace with your own mapping)
38
- categories = ['Blouse', 'Blazer', 'Kemeja', 'Bomber', 'Anorak',
39
- 'Tee', 'Tank', 'Top', 'Sweater', 'Flannel', 'Hoodie',
40
- 'Cardigan', 'Jaket', 'Henley', 'Poncho', 'Jersey', 'Turtleneck', 'Parka',
41
- 'Peacoat', 'Halter', 'Skirt', 'Shorts', 'Jeans', 'Joggers', 'Sweatpants', 'Jeggings',
42
- 'Cutoffs', 'Sweatshorts', 'Leggings', 'Culottes', 'Chinos', 'Culottes', 'Sarung', 'Gauchos', 'Jodhpurs',
43
- 'Capris', 'Dress', 'Romper', 'Coat', 'Kimono', 'Jumpsuit',
44
- 'Robe', 'Caftan', 'Kaftan', 'Coverup', 'Onesie']
45
  return categories[np.argmax(class_label, axis=-1)[0]]
46
 
47
  def generate_text_with_gpt2(product_category, keywords):
 
5
  from tensorflow.image import resize
6
 
7
  # Load the image classification model
8
+ image_classification_model = tf.keras.models.load_model("mobilenetfashion_v2.h5")
9
 
10
  # Load pre-trained GPT-2 model and tokenizer
11
+ gpt2_model_name = "diamantrsd/copywriting-otomatis"
12
  gpt2_model = GPT2LMHeadModel.from_pretrained(gpt2_model_name)
13
  gpt2_tokenizer = GPT2Tokenizer.from_pretrained(gpt2_model_name)
14
 
 
35
 
36
  def map_class_label_to_category(class_label):
37
  # Map the class label to a category (replace with your own mapping)
38
+ categories = [ 'Backpack','Celana Panjang','Celana Pendek','Dompet',
39
+ 'Dress','Kacamata','Kaos', 'Kaos Kaki','Kemeja', 'Outerwear','Sandal', 'Sepatu',
40
+ 'Sepatu Flat','Tas','Topi']
 
 
 
 
41
  return categories[np.argmax(class_label, axis=-1)[0]]
42
 
43
  def generate_text_with_gpt2(product_category, keywords):