Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -112,7 +112,7 @@ def process_chunk(audio_chunk, preprocessed_data, args):
|
|
112 |
|
113 |
first_coeff_path = preprocessed_data["first_coeff_path"]
|
114 |
crop_pic_path = preprocessed_data["crop_pic_path"]
|
115 |
-
crop_info_path =
|
116 |
with open(crop_info_path , "rb") as f:
|
117 |
crop_info = json.load(f)
|
118 |
|
@@ -163,8 +163,8 @@ client = OpenAI(api_key="sk-proj-04146TPzEmvdV6DzSxsvNM7jxOnzys5TnB7iZB0tp59B-jM
|
|
163 |
def openai_chat_avatar(text_prompt):
|
164 |
response = client.chat.completions.create(
|
165 |
model="gpt-4o-mini",
|
166 |
-
messages=[{"role": "system", "content": "
|
167 |
-
{"role": "user", "content": f"Hi! I need help with something.
|
168 |
],
|
169 |
max_tokens = len(text_prompt) + 300 # Use the length of the input text
|
170 |
# temperature=0.3,
|
@@ -242,7 +242,7 @@ def run_preprocessing(args):
|
|
242 |
global path_of_lm_croper, path_of_net_recon_model, dir_of_BFM_fitting
|
243 |
first_frame_dir = os.path.join(args.result_dir, 'first_frame_dir')
|
244 |
os.makedirs(first_frame_dir, exist_ok=True)
|
245 |
-
fixed_temp_dir = "
|
246 |
os.makedirs(fixed_temp_dir, exist_ok=True)
|
247 |
preprocessed_data_path = os.path.join(fixed_temp_dir, "preprocessed_data.pkl")
|
248 |
|
@@ -264,7 +264,7 @@ def generate_video():
|
|
264 |
try:
|
265 |
if request.method == 'POST':
|
266 |
# source_image = request.files['source_image']
|
267 |
-
image_path = '
|
268 |
source_image = Image.open(image_path)
|
269 |
text_prompt = request.form['text_prompt']
|
270 |
|
|
|
112 |
|
113 |
first_coeff_path = preprocessed_data["first_coeff_path"]
|
114 |
crop_pic_path = preprocessed_data["crop_pic_path"]
|
115 |
+
crop_info_path = "/home/user/app/preprocess_data/crop_info.json"
|
116 |
with open(crop_info_path , "rb") as f:
|
117 |
crop_info = json.load(f)
|
118 |
|
|
|
163 |
def openai_chat_avatar(text_prompt):
|
164 |
response = client.chat.completions.create(
|
165 |
model="gpt-4o-mini",
|
166 |
+
messages=[{"role": "system", "content": "Ensure answers are concise, human-like, and clear while maintaining quality. Use the fewest possible words, avoiding unnecessary articles, prepositions, and adjectives. Responses should be short but still address the question thoroughly without being verbose.Keep them to one sentence only"},
|
167 |
+
{"role": "user", "content": f"Hi! I need help with something. {text_prompt}"},
|
168 |
],
|
169 |
max_tokens = len(text_prompt) + 300 # Use the length of the input text
|
170 |
# temperature=0.3,
|
|
|
242 |
global path_of_lm_croper, path_of_net_recon_model, dir_of_BFM_fitting
|
243 |
first_frame_dir = os.path.join(args.result_dir, 'first_frame_dir')
|
244 |
os.makedirs(first_frame_dir, exist_ok=True)
|
245 |
+
fixed_temp_dir = "/home/user/app/preprocess_data/"
|
246 |
os.makedirs(fixed_temp_dir, exist_ok=True)
|
247 |
preprocessed_data_path = os.path.join(fixed_temp_dir, "preprocessed_data.pkl")
|
248 |
|
|
|
264 |
try:
|
265 |
if request.method == 'POST':
|
266 |
# source_image = request.files['source_image']
|
267 |
+
image_path = '/home/user/app/images/marc_smile_enhanced.jpg'
|
268 |
source_image = Image.open(image_path)
|
269 |
text_prompt = request.form['text_prompt']
|
270 |
|