Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# app.py β
|
| 2 |
import os
|
| 3 |
import gradio as gr
|
| 4 |
from pinecone import Pinecone, ServerlessSpec
|
|
@@ -21,9 +21,9 @@ if not PINECONE_API_KEY or not OPENAI_API_KEY:
|
|
| 21 |
raise RuntimeError("Missing PINECONE_API_KEY or OPENAI_API_KEY (set them in Space β Settings β Variables).")
|
| 22 |
|
| 23 |
DATA_DIR = "data" # Put insurance docs here (e.g., data/insurance.pdf)
|
| 24 |
-
LOGO_PATH = os.path.join(DATA_DIR, "
|
| 25 |
if not os.path.exists(LOGO_PATH):
|
| 26 |
-
raise RuntimeError("Logo not found: data/
|
| 27 |
|
| 28 |
EMBED_MODEL = "text-embedding-3-small" # 1536-dim
|
| 29 |
LLM_MODEL = "gpt-4o-mini"
|
|
@@ -97,7 +97,7 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
|
| 97 |
gr.Markdown("<div class='header'>")
|
| 98 |
gr.Image(value=LOGO_PATH, show_label=False, elem_classes=["logo"])
|
| 99 |
gr.Markdown(
|
| 100 |
-
"<h1 class='title'>
|
| 101 |
"<p class='subnote'>Answers strictly from your insurance document(s)</p>"
|
| 102 |
)
|
| 103 |
gr.Markdown("</div>")
|
|
|
|
| 1 |
+
# app.py β Insurance Q&A (RAG) with system prompt + simple config
|
| 2 |
import os
|
| 3 |
import gradio as gr
|
| 4 |
from pinecone import Pinecone, ServerlessSpec
|
|
|
|
| 21 |
raise RuntimeError("Missing PINECONE_API_KEY or OPENAI_API_KEY (set them in Space β Settings β Variables).")
|
| 22 |
|
| 23 |
DATA_DIR = "data" # Put insurance docs here (e.g., data/insurance.pdf)
|
| 24 |
+
LOGO_PATH = os.path.join(DATA_DIR, "dds_logo.png") # Mandatory logo
|
| 25 |
if not os.path.exists(LOGO_PATH):
|
| 26 |
+
raise RuntimeError("Logo not found: data/dds_logo.png.png (commit it to your Space repo).")
|
| 27 |
|
| 28 |
EMBED_MODEL = "text-embedding-3-small" # 1536-dim
|
| 29 |
LLM_MODEL = "gpt-4o-mini"
|
|
|
|
| 97 |
gr.Markdown("<div class='header'>")
|
| 98 |
gr.Image(value=LOGO_PATH, show_label=False, elem_classes=["logo"])
|
| 99 |
gr.Markdown(
|
| 100 |
+
"<h1 class='title'>DDS Insurance Q&A β RAG Assistant</h1>"
|
| 101 |
"<p class='subnote'>Answers strictly from your insurance document(s)</p>"
|
| 102 |
)
|
| 103 |
gr.Markdown("</div>")
|