Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -13,7 +13,9 @@ import gradio as gr
|
|
13 |
import json
|
14 |
import math
|
15 |
import requests
|
16 |
-
|
|
|
|
|
17 |
|
18 |
vidOut = "results/results"
|
19 |
uvqOut = "results/modified_prompts_eval"
|
@@ -90,7 +92,7 @@ def VBench_eval(vid_filename):
|
|
90 |
f'python VBench/evaluate.py --dimension "motion_smoothness" --videos_path {os.path.join(vidOut, vid_filename)}.mp4 --custom_input --output_filename {vid_filename}'
|
91 |
)
|
92 |
eval_file_path = os.path.join(
|
93 |
-
|
94 |
motion_score = extract_scores_from_json(eval_file_path)
|
95 |
|
96 |
return motion_score
|
@@ -110,7 +112,7 @@ def interpolation(chosen_idx, fps):
|
|
110 |
|
111 |
|
112 |
def call_gpt_api(prompt, isSentence=False):
|
113 |
-
api_key = "
|
114 |
|
115 |
response = requests.post(
|
116 |
'https://api.openai.com/v1/chat/completions',
|
|
|
13 |
import json
|
14 |
import math
|
15 |
import requests
|
16 |
+
from dotenv import load_dotenv, dotenv_values
|
17 |
+
# loading variables from .env file
|
18 |
+
load_dotenv()
|
19 |
|
20 |
vidOut = "results/results"
|
21 |
uvqOut = "results/modified_prompts_eval"
|
|
|
92 |
f'python VBench/evaluate.py --dimension "motion_smoothness" --videos_path {os.path.join(vidOut, vid_filename)}.mp4 --custom_input --output_filename {vid_filename}'
|
93 |
)
|
94 |
eval_file_path = os.path.join(
|
95 |
+
evalOut, f"{vid_filename}_eval_results.json")
|
96 |
motion_score = extract_scores_from_json(eval_file_path)
|
97 |
|
98 |
return motion_score
|
|
|
112 |
|
113 |
|
114 |
def call_gpt_api(prompt, isSentence=False):
|
115 |
+
api_key = os.getenv("MY_GPT_KEY")
|
116 |
|
117 |
response = requests.post(
|
118 |
'https://api.openai.com/v1/chat/completions',
|