miaw1419 commited on
Commit
4e4bae1
·
verified ·
1 Parent(s): 6e592e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -141,7 +141,7 @@ comment_images = [
141
  ]
142
 
143
  comments = {'test.png': "Not sure about the concept, it's too straightforward. Though the boy looks kinda creepy which makes it exciting. the art style is pretty to look at. I like that the colors are muted, but wish they were a bit darker to make it more eerie and add depth.", 'comment_images/0.png': "Hate this with a passion. The colors are too vibrant and don't match at all. I hate these colors in general. The patterns are too abstract and contemporary. a 5-year-old could draw this. pass.", 'comment_images/1.png': "Woah I love the art style. The texture feels like old paper which is oh so beautiful. There are so many details to focus on. I love the expressive lines and how busy the composition is. Even though orange isn't my favorite, the greenish blue color of the water is so gorgeous.", 'comment_images/2.png': "I don't like how monochromatic and muted this one is. but the paperish texture is nice and the details are so intricate.", 'comment_images/3.png': "Oh super pretty! Looks so smooth and wet. Love the details and loose lines too. Feels mystical and magical and eerie. Also dark purples and blues? deep indigo? My fav ever. I'm here for it.", 'comment_images/4.png': "Love the art style. The uncanny vibe and nightmarish horror is so cool. Like its horror but if you squint you can't tell? Love the strange. wish it had more colors though. not a fan of greyscale.", 'comment_images/5.png': 'omg I hate this haha. what the hell. everything about it disgusts me so boring and childish ew.', 'comment_images/6.png': 'yessss. give it to the texture give it to the brushstrokes give it to the style. perfect. just wish the colors were less beige and more bold. I want an active nightmare. but kisses to the surrealism.'}
144
- comments = dict()
145
 
146
  image_index = 0
147
 
@@ -210,13 +210,6 @@ def clear_comments():
210
  @spaces.GPU(duration=200)
211
  def extract_vp():
212
  if valid_api == "":
213
- vpe_model = AutoModelForVision2Seq.from_pretrained(
214
- "HuggingFaceM4/idefics2-8b",
215
- torch_dtype=torch.float16,
216
- quantization_config=bnb_config,
217
- )
218
-
219
- vpe_model = PeftModel.from_pretrained(vpe_model, "VPE2").to("cuda")
220
 
221
  global comments
222
 
@@ -261,7 +254,6 @@ Here are the images and their corresponding comments:
261
  inputs = {k: v.to(device) for k, v in inputs.items()}
262
 
263
  generated_ids = vpe_model.generate(**inputs, max_new_tokens=2000, repetition_penalty=0.99, do_sample=False)
264
- del vpe_model
265
  generated_texts = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
266
  positive_vp, negative_vp = re.search('.* \nAssistant: Liked Art Features: (.*)\nDisliked Art Features: (.*)', generated_texts).groups()
267
 
 
141
  ]
142
 
143
  comments = {'test.png': "Not sure about the concept, it's too straightforward. Though the boy looks kinda creepy which makes it exciting. the art style is pretty to look at. I like that the colors are muted, but wish they were a bit darker to make it more eerie and add depth.", 'comment_images/0.png': "Hate this with a passion. The colors are too vibrant and don't match at all. I hate these colors in general. The patterns are too abstract and contemporary. a 5-year-old could draw this. pass.", 'comment_images/1.png': "Woah I love the art style. The texture feels like old paper which is oh so beautiful. There are so many details to focus on. I love the expressive lines and how busy the composition is. Even though orange isn't my favorite, the greenish blue color of the water is so gorgeous.", 'comment_images/2.png': "I don't like how monochromatic and muted this one is. but the paperish texture is nice and the details are so intricate.", 'comment_images/3.png': "Oh super pretty! Looks so smooth and wet. Love the details and loose lines too. Feels mystical and magical and eerie. Also dark purples and blues? deep indigo? My fav ever. I'm here for it.", 'comment_images/4.png': "Love the art style. The uncanny vibe and nightmarish horror is so cool. Like its horror but if you squint you can't tell? Love the strange. wish it had more colors though. not a fan of greyscale.", 'comment_images/5.png': 'omg I hate this haha. what the hell. everything about it disgusts me so boring and childish ew.', 'comment_images/6.png': 'yessss. give it to the texture give it to the brushstrokes give it to the style. perfect. just wish the colors were less beige and more bold. I want an active nightmare. but kisses to the surrealism.'}
144
+ #comments = dict()
145
 
146
  image_index = 0
147
 
 
210
  @spaces.GPU(duration=200)
211
  def extract_vp():
212
  if valid_api == "":
 
 
 
 
 
 
 
213
 
214
  global comments
215
 
 
254
  inputs = {k: v.to(device) for k, v in inputs.items()}
255
 
256
  generated_ids = vpe_model.generate(**inputs, max_new_tokens=2000, repetition_penalty=0.99, do_sample=False)
 
257
  generated_texts = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
258
  positive_vp, negative_vp = re.search('.* \nAssistant: Liked Art Features: (.*)\nDisliked Art Features: (.*)', generated_texts).groups()
259