Spaces:
Runtime error
Runtime error
Commit
·
3ef2358
1
Parent(s):
a68b189
add infinity and chinese support
Browse files
visual_foundation_models.py
CHANGED
|
@@ -796,7 +796,7 @@ class VisualQuestionAnswering:
|
|
| 796 |
class InfinityOutPainting:
|
| 797 |
template_model = True # Add this line to show this is a template model.
|
| 798 |
def __init__(self, ImageCaptioning, ImageEditing, VisualQuestionAnswering):
|
| 799 |
-
self.llm = OpenAI(temperature=0)
|
| 800 |
self.ImageCaption = ImageCaptioning
|
| 801 |
self.ImageEditing = ImageEditing
|
| 802 |
self.ImageVQA = VisualQuestionAnswering
|
|
@@ -819,11 +819,11 @@ class InfinityOutPainting:
|
|
| 819 |
BLIP_caption = self.ImageCaption.processor.decode(out[0], skip_special_tokens=True)
|
| 820 |
return BLIP_caption
|
| 821 |
|
| 822 |
-
def check_prompt(self, prompt):
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
|
| 828 |
def get_imagine_caption(self, image, imagine):
|
| 829 |
BLIP_caption = self.get_BLIP_caption(image)
|
|
@@ -836,8 +836,9 @@ class InfinityOutPainting:
|
|
| 836 |
f"You should make the painting as vivid and realistic as possible" \
|
| 837 |
f"You can not use words like painting or picture" \
|
| 838 |
f"and you should use no more than 50 words to describe it"
|
| 839 |
-
caption = self.llm(imagine_prompt) if imagine else BLIP_caption
|
| 840 |
-
caption =
|
|
|
|
| 841 |
print(f'BLIP observation: {BLIP_caption}, ChatGPT imagine to {caption}') if imagine else print(
|
| 842 |
f'Prompt: {caption}')
|
| 843 |
return caption
|
|
|
|
| 796 |
class InfinityOutPainting:
|
| 797 |
template_model = True # Add this line to show this is a template model.
|
| 798 |
def __init__(self, ImageCaptioning, ImageEditing, VisualQuestionAnswering):
|
| 799 |
+
# self.llm = OpenAI(temperature=0)
|
| 800 |
self.ImageCaption = ImageCaptioning
|
| 801 |
self.ImageEditing = ImageEditing
|
| 802 |
self.ImageVQA = VisualQuestionAnswering
|
|
|
|
| 819 |
BLIP_caption = self.ImageCaption.processor.decode(out[0], skip_special_tokens=True)
|
| 820 |
return BLIP_caption
|
| 821 |
|
| 822 |
+
# def check_prompt(self, prompt):
|
| 823 |
+
# check = f"Here is a paragraph with adjectives. " \
|
| 824 |
+
# f"{prompt} " \
|
| 825 |
+
# f"Please change all plural forms in the adjectives to singular forms. "
|
| 826 |
+
# return self.llm(check)
|
| 827 |
|
| 828 |
def get_imagine_caption(self, image, imagine):
|
| 829 |
BLIP_caption = self.get_BLIP_caption(image)
|
|
|
|
| 836 |
f"You should make the painting as vivid and realistic as possible" \
|
| 837 |
f"You can not use words like painting or picture" \
|
| 838 |
f"and you should use no more than 50 words to describe it"
|
| 839 |
+
# caption = self.llm(imagine_prompt) if imagine else BLIP_caption
|
| 840 |
+
caption = BLIP_caption
|
| 841 |
+
# caption = self.check_prompt(caption)
|
| 842 |
print(f'BLIP observation: {BLIP_caption}, ChatGPT imagine to {caption}') if imagine else print(
|
| 843 |
f'Prompt: {caption}')
|
| 844 |
return caption
|