friedrichor commited on
Commit
a6d3762
1 Parent(s): ae6cc83
Files changed (1) hide show
  1. chatbot.py +8 -3
chatbot.py CHANGED
@@ -1,6 +1,7 @@
1
- import torch
2
-
3
 
 
4
  from model import IntentPredictModel
5
  from transformers import T5Tokenizer, GPT2LMHeadModel, GPT2Tokenizer
6
  from diffusers import StableDiffusionPipeline
@@ -28,6 +29,9 @@ class Chat:
28
  self.human_words = ["man", "men", "woman", "women", "people", "person", "human", "male", "female", "boy", "girl", "child", "kid", "baby", "player"]
29
  self.negative_prompt="cartoon, anime, ugly, asian, (aged, white beard, black skin, wrinkle:1.1), (bad proportions, unnatural feature, incongruous feature:1.4), (blurry, un-sharp, fuzzy, un-detailed skin:1.2), (facial contortion, poorly drawn face, deformed iris, deformed pupils:1.3), (mutated hands and fingers:1.5), disconnected hands, disconnected limbs"
30
 
 
 
 
31
  self.context_for_intent = ""
32
  self.context_for_text_dialog = ""
33
 
@@ -112,7 +116,8 @@ class Chat:
112
  num_inference_steps=20,
113
  guidance_scale=7.5,
114
  generator=generator).images[0]
115
- save_image_path = f"generated_images/{response}.png"
 
116
  image.save(save_image_path)
117
 
118
  self.context_for_intent += " [SEP] " + response
 
1
+ import os
2
+ import sys
3
 
4
+ import torch
5
  from model import IntentPredictModel
6
  from transformers import T5Tokenizer, GPT2LMHeadModel, GPT2Tokenizer
7
  from diffusers import StableDiffusionPipeline
 
29
  self.human_words = ["man", "men", "woman", "women", "people", "person", "human", "male", "female", "boy", "girl", "child", "kid", "baby", "player"]
30
  self.negative_prompt="cartoon, anime, ugly, asian, (aged, white beard, black skin, wrinkle:1.1), (bad proportions, unnatural feature, incongruous feature:1.4), (blurry, un-sharp, fuzzy, un-detailed skin:1.2), (facial contortion, poorly drawn face, deformed iris, deformed pupils:1.3), (mutated hands and fingers:1.5), disconnected hands, disconnected limbs"
31
 
32
+ self.save_images_folder = os.path.join(sys.path[0], "generated_images")
33
+ os.makedirs(self.save_images_folder, exist_ok=True)
34
+
35
  self.context_for_intent = ""
36
  self.context_for_text_dialog = ""
37
 
 
116
  num_inference_steps=20,
117
  guidance_scale=7.5,
118
  generator=generator).images[0]
119
+
120
+ save_image_path = f"{self.save_images_folder}/{response}.png"
121
  image.save(save_image_path)
122
 
123
  self.context_for_intent += " [SEP] " + response