Spaces:
Paused
Paused
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -202,7 +202,7 @@ def generate_spec(
|
|
| 202 |
input_len = inputs["input_ids"].shape[-1]
|
| 203 |
|
| 204 |
# Check if input is too long -- truncate RAG context if needed
|
| 205 |
-
if input_len >
|
| 206 |
# Retry without RAG context
|
| 207 |
messages = [
|
| 208 |
{"role": "system", "content": SYSTEM_MESSAGE},
|
|
@@ -257,7 +257,7 @@ def create_app():
|
|
| 257 |
with gr.Row():
|
| 258 |
temperature = gr.Slider(0.0, 2.0, value=0.7, step=0.1, label="Temperature")
|
| 259 |
top_p = gr.Slider(0.0, 1.0, value=0.9, step=0.05, label="Top-p")
|
| 260 |
-
max_tokens = gr.Slider(256,
|
| 261 |
use_rag = gr.Checkbox(value=True, label="Use RAG (retrieve similar examples)")
|
| 262 |
generate_btn = gr.Button("Generate Specification", variant="primary")
|
| 263 |
|
|
|
|
| 202 |
input_len = inputs["input_ids"].shape[-1]
|
| 203 |
|
| 204 |
# Check if input is too long -- truncate RAG context if needed
|
| 205 |
+
if input_len > 6000 and use_rag:
|
| 206 |
# Retry without RAG context
|
| 207 |
messages = [
|
| 208 |
{"role": "system", "content": SYSTEM_MESSAGE},
|
|
|
|
| 257 |
with gr.Row():
|
| 258 |
temperature = gr.Slider(0.0, 2.0, value=0.7, step=0.1, label="Temperature")
|
| 259 |
top_p = gr.Slider(0.0, 1.0, value=0.9, step=0.05, label="Top-p")
|
| 260 |
+
max_tokens = gr.Slider(256, 8192, value=2048, step=256, label="Max Tokens")
|
| 261 |
use_rag = gr.Checkbox(value=True, label="Use RAG (retrieve similar examples)")
|
| 262 |
generate_btn = gr.Button("Generate Specification", variant="primary")
|
| 263 |
|