Spaces:
Running
Running
gokaygokay
commited on
Commit
•
c53d44b
1
Parent(s):
affa992
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
from datetime import datetime
|
2 |
import gradio as gr
|
3 |
import random
|
4 |
import json
|
5 |
import os
|
6 |
import re
|
7 |
from openai import OpenAI
|
|
|
8 |
|
9 |
# Load JSON files
|
10 |
def load_json_file(file_name):
|
@@ -275,8 +275,8 @@ class GPT4MiniNode:
|
|
275 |
|
276 |
def generate(self, api_key, input_text, happy_talk, compress, compression_level, poster, custom_base_prompt=""):
|
277 |
try:
|
278 |
-
# Initialize the OpenAI client with the provided API key
|
279 |
self.client = OpenAI(api_key=api_key)
|
|
|
280 |
default_happy_prompt = """Create a detailed visually descriptive caption of this description, which will be used as a prompt for a text to image AI system (caption only, no instructions like "create an image").Remove any mention of digital artwork or artwork style. Give detailed visual descriptions of the character(s), including ethnicity, skin tone, expression etc. Imagine using keywords for a still for someone who has aphantasia. Describe the image style, e.g. any photographic or art styles / techniques utilized. Make sure to fully describe all aspects of the cinematography, with abundant technical details and visual descriptions. If there is more than one image, combine the elements and characters from all of the images creatively into a single cohesive composition with a single background, inventing an interaction between the characters. Be creative in combining the characters into a single cohesive scene. Focus on two primary characters (or one) and describe an interesting interaction between them, such as a hug, a kiss, a fight, giving an object, an emotional reaction / interaction. If there is more than one background in the images, pick the most appropriate one. Your output is only the caption itself, no comments or extra formatting. The caption is in a single long paragraph. If you feel the images are inappropriate, invent a new scene / characters inspired by these. Additionally, incorporate a specific movie director's visual style (e.g. Wes Anderson, Christopher Nolan, Quentin Tarantino) and describe the lighting setup in detail, including the type, color, and placement of light sources to create the desired mood and atmosphere. Always frame the scene as a screen grab from a 35mm film still, including details about the film grain, color grading, and any artifacts or characteristics specific to 35mm film photography."""
|
281 |
|
282 |
default_simple_prompt = """Create a brief, straightforward caption for this description, suitable for a text-to-image AI system. Focus on the main elements, key characters, and overall scene without elaborate details. Provide a clear and concise description in one or two sentences."""
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import random
|
3 |
import json
|
4 |
import os
|
5 |
import re
|
6 |
from openai import OpenAI
|
7 |
+
from datetime import datetime
|
8 |
|
9 |
# Load JSON files
|
10 |
def load_json_file(file_name):
|
|
|
275 |
|
276 |
def generate(self, api_key, input_text, happy_talk, compress, compression_level, poster, custom_base_prompt=""):
|
277 |
try:
|
|
|
278 |
self.client = OpenAI(api_key=api_key)
|
279 |
+
|
280 |
default_happy_prompt = """Create a detailed visually descriptive caption of this description, which will be used as a prompt for a text to image AI system (caption only, no instructions like "create an image").Remove any mention of digital artwork or artwork style. Give detailed visual descriptions of the character(s), including ethnicity, skin tone, expression etc. Imagine using keywords for a still for someone who has aphantasia. Describe the image style, e.g. any photographic or art styles / techniques utilized. Make sure to fully describe all aspects of the cinematography, with abundant technical details and visual descriptions. If there is more than one image, combine the elements and characters from all of the images creatively into a single cohesive composition with a single background, inventing an interaction between the characters. Be creative in combining the characters into a single cohesive scene. Focus on two primary characters (or one) and describe an interesting interaction between them, such as a hug, a kiss, a fight, giving an object, an emotional reaction / interaction. If there is more than one background in the images, pick the most appropriate one. Your output is only the caption itself, no comments or extra formatting. The caption is in a single long paragraph. If you feel the images are inappropriate, invent a new scene / characters inspired by these. Additionally, incorporate a specific movie director's visual style (e.g. Wes Anderson, Christopher Nolan, Quentin Tarantino) and describe the lighting setup in detail, including the type, color, and placement of light sources to create the desired mood and atmosphere. Always frame the scene as a screen grab from a 35mm film still, including details about the film grain, color grading, and any artifacts or characteristics specific to 35mm film photography."""
|
281 |
|
282 |
default_simple_prompt = """Create a brief, straightforward caption for this description, suitable for a text-to-image AI system. Focus on the main elements, key characters, and overall scene without elaborate details. Provide a clear and concise description in one or two sentences."""
|