Spaces:
Running
Running
openreviewer
commited on
Commit
•
9342d22
1
Parent(s):
36c53d0
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ api_keys = {
|
|
26 |
'commandr_api_key': os.environ.get('COMMANDR_API_KEY')
|
27 |
}
|
28 |
|
29 |
-
|
30 |
use_real_api = True
|
31 |
|
32 |
# Function to generate a paper_id using SHA-512 hash
|
|
|
26 |
'commandr_api_key': os.environ.get('COMMANDR_API_KEY')
|
27 |
}
|
28 |
|
29 |
+
##
|
30 |
use_real_api = True
|
31 |
|
32 |
# Function to generate a paper_id using SHA-512 hash
|
models.py
CHANGED
@@ -17,7 +17,7 @@ class Paper:
|
|
17 |
|
18 |
class PaperProcessor:
|
19 |
MAX_TOKENS = 127192
|
20 |
-
encoding = tiktoken.encoding_for_model("gpt-4
|
21 |
|
22 |
def __init__(self, prompt_dir, model, openai_api_key, claude_api_key, gemini_api_key, commandr_api_key):
|
23 |
self.prompt_dir = prompt_dir
|
@@ -42,6 +42,8 @@ class PaperProcessor:
|
|
42 |
return content
|
43 |
|
44 |
def prepare_base_prompt(self, paper):
|
|
|
|
|
45 |
return paper.tex_file
|
46 |
|
47 |
def call_model(self, prompt, model_type):
|
@@ -127,6 +129,7 @@ class PaperProcessor:
|
|
127 |
start_time = time.time()
|
128 |
|
129 |
base_prompt = self.prepare_base_prompt(paper)
|
|
|
130 |
if base_prompt is None:
|
131 |
return "Error: Base prompt could not be prepared."
|
132 |
|
|
|
17 |
|
18 |
class PaperProcessor:
|
19 |
MAX_TOKENS = 127192
|
20 |
+
encoding = tiktoken.encoding_for_model("gpt-4")
|
21 |
|
22 |
def __init__(self, prompt_dir, model, openai_api_key, claude_api_key, gemini_api_key, commandr_api_key):
|
23 |
self.prompt_dir = prompt_dir
|
|
|
42 |
return content
|
43 |
|
44 |
def prepare_base_prompt(self, paper):
|
45 |
+
logging.debug(f"Preparing base prompt for paper: {paper.arxiv_id}")
|
46 |
+
logging.debug(f"Paper content: {paper.tex_file[:500]}") # Log the first 500 characters
|
47 |
return paper.tex_file
|
48 |
|
49 |
def call_model(self, prompt, model_type):
|
|
|
129 |
start_time = time.time()
|
130 |
|
131 |
base_prompt = self.prepare_base_prompt(paper)
|
132 |
+
print("BASE PROMPT:", base_prompt)
|
133 |
if base_prompt is None:
|
134 |
return "Error: Base prompt could not be prepared."
|
135 |
|