Spaces:
Running
Running
drop down
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import json
|
3 |
from rag.rag_pipeline import RAGPipeline
|
@@ -9,6 +11,7 @@ from utils.prompts import (
|
|
9 |
)
|
10 |
from config import STUDY_FILES
|
11 |
|
|
|
12 |
rag_cache = {}
|
13 |
|
14 |
|
@@ -57,7 +60,7 @@ def get_study_info(study_name):
|
|
57 |
|
58 |
|
59 |
def update_sample_questions(study_name):
|
60 |
-
return gr.Dropdown
|
61 |
|
62 |
|
63 |
with gr.Blocks() as demo:
|
@@ -73,7 +76,9 @@ with gr.Blocks() as demo:
|
|
73 |
|
74 |
with gr.Row():
|
75 |
question_input = gr.Textbox(label="Enter your question")
|
76 |
-
sample_question_dropdown = gr.Dropdown(
|
|
|
|
|
77 |
|
78 |
study_dropdown.change(
|
79 |
update_sample_questions,
|
@@ -107,4 +112,4 @@ with gr.Blocks() as demo:
|
|
107 |
)
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
-
demo.launch()
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
import gradio as gr
|
4 |
import json
|
5 |
from rag.rag_pipeline import RAGPipeline
|
|
|
11 |
)
|
12 |
from config import STUDY_FILES
|
13 |
|
14 |
+
# Cache for RAG pipelines
|
15 |
rag_cache = {}
|
16 |
|
17 |
|
|
|
60 |
|
61 |
|
62 |
def update_sample_questions(study_name):
|
63 |
+
return gr.Dropdown(choices=sample_questions.get(study_name, []), interactive=True)
|
64 |
|
65 |
|
66 |
with gr.Blocks() as demo:
|
|
|
76 |
|
77 |
with gr.Row():
|
78 |
question_input = gr.Textbox(label="Enter your question")
|
79 |
+
sample_question_dropdown = gr.Dropdown(
|
80 |
+
choices=[], label="Sample Questions", interactive=True
|
81 |
+
)
|
82 |
|
83 |
study_dropdown.change(
|
84 |
update_sample_questions,
|
|
|
112 |
)
|
113 |
|
114 |
if __name__ == "__main__":
|
115 |
+
demo.launch(share=True)
|