Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def generate_test_cases(text, prompt_template):
|
|
25 |
]
|
26 |
|
27 |
full_content = ""
|
28 |
-
max_iterations =
|
29 |
iteration = 0
|
30 |
|
31 |
while iteration < max_iterations:
|
@@ -47,7 +47,7 @@ def generate_test_cases(text, prompt_template):
|
|
47 |
full_content += "\n" + part
|
48 |
|
49 |
finish_reason = response.choices[0].get("finish_reason", None)
|
50 |
-
# If the response
|
51 |
if finish_reason == "length" or part.endswith("..."):
|
52 |
messages.append({"role": "assistant", "content": part})
|
53 |
messages.append({"role": "user", "content": "Please continue with the remaining test cases."})
|
@@ -60,6 +60,7 @@ def generate_test_cases(text, prompt_template):
|
|
60 |
return full_content.strip()
|
61 |
|
62 |
|
|
|
63 |
def process_pdf(pdf_file, selected_block, prompt_template):
|
64 |
block_config = {
|
65 |
"5.4.1 OSPI-xSPI-QSPI-SPI Boot": (482, 488),
|
|
|
25 |
]
|
26 |
|
27 |
full_content = ""
|
28 |
+
max_iterations = 10
|
29 |
iteration = 0
|
30 |
|
31 |
while iteration < max_iterations:
|
|
|
47 |
full_content += "\n" + part
|
48 |
|
49 |
finish_reason = response.choices[0].get("finish_reason", None)
|
50 |
+
# If the response appears truncated, ask the model to continue
|
51 |
if finish_reason == "length" or part.endswith("..."):
|
52 |
messages.append({"role": "assistant", "content": part})
|
53 |
messages.append({"role": "user", "content": "Please continue with the remaining test cases."})
|
|
|
60 |
return full_content.strip()
|
61 |
|
62 |
|
63 |
+
|
64 |
def process_pdf(pdf_file, selected_block, prompt_template):
|
65 |
block_config = {
|
66 |
"5.4.1 OSPI-xSPI-QSPI-SPI Boot": (482, 488),
|