Spaces:
Running
Running
markdownify
Browse files
app.py
CHANGED
@@ -29,7 +29,11 @@ def query_rag(study_name, question, prompt_type):
|
|
29 |
prompt = None
|
30 |
|
31 |
response = rag.query(question, prompt)
|
32 |
-
|
|
|
|
|
|
|
|
|
33 |
|
34 |
|
35 |
def get_study_info(study_name):
|
@@ -37,7 +41,7 @@ def get_study_info(study_name):
|
|
37 |
if study_file:
|
38 |
with open(study_file, "r") as f:
|
39 |
data = json.load(f)
|
40 |
-
return f"Number of documents
|
41 |
else:
|
42 |
return "Invalid study name"
|
43 |
|
@@ -63,7 +67,8 @@ with gr.Blocks() as demo:
|
|
63 |
|
64 |
submit_button = gr.Button("Submit")
|
65 |
|
66 |
-
answer_output = gr.Textbox(label="Answer")
|
|
|
67 |
|
68 |
submit_button.click(
|
69 |
query_rag,
|
|
|
29 |
prompt = None
|
30 |
|
31 |
response = rag.query(question, prompt)
|
32 |
+
formatted_response = (
|
33 |
+
f"## Question\n\n{question}\n\n## Answer\n\n{response.response}"
|
34 |
+
)
|
35 |
+
|
36 |
+
return formatted_response
|
37 |
|
38 |
|
39 |
def get_study_info(study_name):
|
|
|
41 |
if study_file:
|
42 |
with open(study_file, "r") as f:
|
43 |
data = json.load(f)
|
44 |
+
return f"**Number of documents:** {len(data)}\n\n**First document title:** {data[0]['title']}"
|
45 |
else:
|
46 |
return "Invalid study name"
|
47 |
|
|
|
67 |
|
68 |
submit_button = gr.Button("Submit")
|
69 |
|
70 |
+
# answer_output = gr.Textbox(label="Answer")
|
71 |
+
answer_output = gr.Markdown(label="Answer")
|
72 |
|
73 |
submit_button.click(
|
74 |
query_rag,
|