Spaces:
Running
Running
Emmanuel Acheampong commited on
Commit ·
683cb49
1
Parent(s): 296f21f
Fix Gradio compatability
Browse files
app.py
CHANGED
|
@@ -115,8 +115,8 @@ def legal_ingest(files):
|
|
| 115 |
return "No files uploaded.", "0 tokens", gr.update()
|
| 116 |
combined = ""
|
| 117 |
for f in files:
|
| 118 |
-
combined += f"\n\n--- {os.path.basename(f
|
| 119 |
-
combined += read_uploaded_file(f
|
| 120 |
legal_doc_store["text"] = combined
|
| 121 |
legal_doc_store["tokens"] = count_tokens(combined)
|
| 122 |
tok_str = format_tokens(legal_doc_store["tokens"])
|
|
@@ -153,8 +153,8 @@ dev_code_store = {"text": "", "tokens": 0}
|
|
| 153 |
def dev_ingest(files, raw_paste):
|
| 154 |
combined = raw_paste or ""
|
| 155 |
for f in (files or []):
|
| 156 |
-
combined += f"\n\n# === {os.path.basename(f
|
| 157 |
-
combined += read_uploaded_file(f
|
| 158 |
dev_code_store["text"] = combined
|
| 159 |
dev_code_store["tokens"] = count_tokens(combined)
|
| 160 |
tok_str = format_tokens(dev_code_store["tokens"])
|
|
@@ -299,7 +299,7 @@ with gr.Blocks(title="Crusoe Foundry — Infinite Context Demo") as demo:
|
|
| 299 |
placeholder="Document text will appear here after loading…",
|
| 300 |
)
|
| 301 |
with gr.Column(scale=2):
|
| 302 |
-
legal_chatbot = gr.Chatbot(label="Legal Q&A", height=420)
|
| 303 |
with gr.Row():
|
| 304 |
legal_input = gr.Textbox(
|
| 305 |
placeholder="e.g. What are all indemnification carve-outs?",
|
|
@@ -371,7 +371,7 @@ with gr.Blocks(title="Crusoe Foundry — Infinite Context Demo") as demo:
|
|
| 371 |
placeholder="Loaded code will appear here…",
|
| 372 |
)
|
| 373 |
with gr.Column(scale=2):
|
| 374 |
-
dev_chatbot = gr.Chatbot(label="Codebase Q&A", height=420)
|
| 375 |
with gr.Row():
|
| 376 |
dev_input = gr.Textbox(
|
| 377 |
placeholder="e.g. Where is the authentication logic and how does it work?",
|
|
@@ -443,6 +443,7 @@ with gr.Blocks(title="Crusoe Foundry — Infinite Context Demo") as demo:
|
|
| 443 |
memory_chatbot = gr.Chatbot(
|
| 444 |
label="Memory-Augmented Chat",
|
| 445 |
height=380,
|
|
|
|
| 446 |
)
|
| 447 |
with gr.Row():
|
| 448 |
memory_input = gr.Textbox(
|
|
@@ -498,4 +499,4 @@ with gr.Blocks(title="Crusoe Foundry — Infinite Context Demo") as demo:
|
|
| 498 |
|
| 499 |
|
| 500 |
if __name__ == "__main__":
|
| 501 |
-
demo.launch(
|
|
|
|
| 115 |
return "No files uploaded.", "0 tokens", gr.update()
|
| 116 |
combined = ""
|
| 117 |
for f in files:
|
| 118 |
+
combined += f"\n\n--- {os.path.basename(f)} ---\n\n"
|
| 119 |
+
combined += read_uploaded_file(f)
|
| 120 |
legal_doc_store["text"] = combined
|
| 121 |
legal_doc_store["tokens"] = count_tokens(combined)
|
| 122 |
tok_str = format_tokens(legal_doc_store["tokens"])
|
|
|
|
| 153 |
def dev_ingest(files, raw_paste):
|
| 154 |
combined = raw_paste or ""
|
| 155 |
for f in (files or []):
|
| 156 |
+
combined += f"\n\n# === {os.path.basename(f)} ===\n\n"
|
| 157 |
+
combined += read_uploaded_file(f)
|
| 158 |
dev_code_store["text"] = combined
|
| 159 |
dev_code_store["tokens"] = count_tokens(combined)
|
| 160 |
tok_str = format_tokens(dev_code_store["tokens"])
|
|
|
|
| 299 |
placeholder="Document text will appear here after loading…",
|
| 300 |
)
|
| 301 |
with gr.Column(scale=2):
|
| 302 |
+
legal_chatbot = gr.Chatbot(label="Legal Q&A", height=420, type="tuples")
|
| 303 |
with gr.Row():
|
| 304 |
legal_input = gr.Textbox(
|
| 305 |
placeholder="e.g. What are all indemnification carve-outs?",
|
|
|
|
| 371 |
placeholder="Loaded code will appear here…",
|
| 372 |
)
|
| 373 |
with gr.Column(scale=2):
|
| 374 |
+
dev_chatbot = gr.Chatbot(label="Codebase Q&A", height=420, type="tuples")
|
| 375 |
with gr.Row():
|
| 376 |
dev_input = gr.Textbox(
|
| 377 |
placeholder="e.g. Where is the authentication logic and how does it work?",
|
|
|
|
| 443 |
memory_chatbot = gr.Chatbot(
|
| 444 |
label="Memory-Augmented Chat",
|
| 445 |
height=380,
|
| 446 |
+
type="tuples",
|
| 447 |
)
|
| 448 |
with gr.Row():
|
| 449 |
memory_input = gr.Textbox(
|
|
|
|
| 499 |
|
| 500 |
|
| 501 |
if __name__ == "__main__":
|
| 502 |
+
demo.launch(theme=gr.themes.Soft(primary_hue="blue"), css=css)
|