Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ from crawl4ai import AsyncWebCrawler
|
|
| 23 |
|
| 24 |
# ---------------- Config ----------------
|
| 25 |
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
|
| 26 |
-
OPENROUTER_MODEL = "
|
| 27 |
EMBEDDING_MODEL_NAME = "all-MiniLM-L6-v2"
|
| 28 |
CACHE_DIR = "./cache"
|
| 29 |
os.makedirs(CACHE_DIR, exist_ok=True)
|
|
@@ -408,8 +408,8 @@ with gr.Blocks(title="AI Ally (Gradio) — Crawl4AI + OpenRouter + FAISS") as de
|
|
| 408 |
upload_btn.click(upload_and_index, inputs=[file_input], outputs=[upload_status, preview_box])
|
| 409 |
|
| 410 |
gr.Markdown("### Ask about the indexed documents")
|
| 411 |
-
q = gr.Textbox(label="Question", lines=
|
| 412 |
-
sys_prompt = gr.Textbox(label="Optional System Prompt (sent to LLM)", lines=
|
| 413 |
ask_btn = gr.Button("Ask")
|
| 414 |
answer_out = gr.Textbox(label="Answer JSON", interactive=False)
|
| 415 |
ask_btn.click(ask_question, inputs=[q, sys_prompt], outputs=[answer_out])
|
|
@@ -424,8 +424,8 @@ with gr.Blocks(title="AI Ally (Gradio) — Crawl4AI + OpenRouter + FAISS") as de
|
|
| 424 |
crawl_btn.click(crawl_and_index, inputs=[url], outputs=[crawl_status, crawl_preview])
|
| 425 |
|
| 426 |
gr.Markdown("### Ask about the crawled site")
|
| 427 |
-
q2 = gr.Textbox(label="Question", lines=
|
| 428 |
-
sys_prompt2 = gr.Textbox(label="Optional System Prompt (sent to LLM)", lines=
|
| 429 |
ask_btn2 = gr.Button("Ask site")
|
| 430 |
answer_out2 = gr.Textbox(label="Answer JSON", interactive=False)
|
| 431 |
ask_btn2.click(ask_question, inputs=[q2, sys_prompt2], outputs=[answer_out2])
|
|
|
|
| 23 |
|
| 24 |
# ---------------- Config ----------------
|
| 25 |
OPENROUTER_API_KEY = os.getenv("OPENROUTER_API_KEY")
|
| 26 |
+
OPENROUTER_MODEL = "nvidia/nemotron-nano-12b-v2-vl:free"
|
| 27 |
EMBEDDING_MODEL_NAME = "all-MiniLM-L6-v2"
|
| 28 |
CACHE_DIR = "./cache"
|
| 29 |
os.makedirs(CACHE_DIR, exist_ok=True)
|
|
|
|
| 408 |
upload_btn.click(upload_and_index, inputs=[file_input], outputs=[upload_status, preview_box])
|
| 409 |
|
| 410 |
gr.Markdown("### Ask about the indexed documents")
|
| 411 |
+
q = gr.Textbox(label="Question", lines=30)
|
| 412 |
+
sys_prompt = gr.Textbox(label="Optional System Prompt (sent to LLM)", lines=20, value="You are a helpful assistant.")
|
| 413 |
ask_btn = gr.Button("Ask")
|
| 414 |
answer_out = gr.Textbox(label="Answer JSON", interactive=False)
|
| 415 |
ask_btn.click(ask_question, inputs=[q, sys_prompt], outputs=[answer_out])
|
|
|
|
| 424 |
crawl_btn.click(crawl_and_index, inputs=[url], outputs=[crawl_status, crawl_preview])
|
| 425 |
|
| 426 |
gr.Markdown("### Ask about the crawled site")
|
| 427 |
+
q2 = gr.Textbox(label="Question", lines=30)
|
| 428 |
+
sys_prompt2 = gr.Textbox(label="Optional System Prompt (sent to LLM)", lines=20, value="You are a helpful assistant.")
|
| 429 |
ask_btn2 = gr.Button("Ask site")
|
| 430 |
answer_out2 = gr.Textbox(label="Answer JSON", interactive=False)
|
| 431 |
ask_btn2.click(ask_question, inputs=[q2, sys_prompt2], outputs=[answer_out2])
|