Spaces:
Runtime error
Runtime error
Commit ·
61477db
1
Parent(s): d832d3e
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,47 +54,32 @@ def get_Answer(query):
|
|
| 54 |
answer = model.generate_content(prompt).text
|
| 55 |
return answer
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
# Define the Gradio interface
|
| 69 |
iface2 = gr.Interface(
|
| 70 |
-
fn=
|
| 71 |
-
inputs=["file"], # Specify a file input component
|
| 72 |
outputs="textbox", # Display the output text in a textbox
|
| 73 |
-
title="Upload
|
| 74 |
-
description="
|
| 75 |
)
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
# def check_boxes(checkbox_values):
|
| 80 |
-
# if checkbox_values == "iface1":
|
| 81 |
-
# return iface1.launch(debug=True, share=True)
|
| 82 |
-
# else:
|
| 83 |
-
# return iface1.launch(debug=True, share=True)
|
| 84 |
-
|
| 85 |
-
# checkboxes = [
|
| 86 |
-
# gr.Checkbox(label="iface1"),
|
| 87 |
-
# gr.Checkbox(label="iface2"),
|
| 88 |
-
# ]
|
| 89 |
-
|
| 90 |
-
# iface = gr.Interface(
|
| 91 |
-
# check_boxes,
|
| 92 |
-
# inputs=checkboxes,
|
| 93 |
-
# outputs="text",
|
| 94 |
-
# title="Checkbox Demo",
|
| 95 |
-
# description="Select one or both checkboxes.",
|
| 96 |
-
# )
|
| 97 |
-
|
| 98 |
iface2.launch(debug=True)
|
| 99 |
|
| 100 |
|
|
|
|
| 54 |
answer = model.generate_content(prompt).text
|
| 55 |
return answer
|
| 56 |
|
| 57 |
+
def Show_Interface(file_path,query):
|
| 58 |
+
if file_path:
|
| 59 |
+
return upload_pdf(file_path)
|
| 60 |
+
else:
|
| 61 |
+
return get_Answer(query)
|
| 62 |
+
|
| 63 |
+
# # Define the Gradio interface
|
| 64 |
+
# iface1 = gr.Interface(
|
| 65 |
+
# fn=get_Answer,
|
| 66 |
+
# inputs=gr.Textbox(lines=5, placeholder="Ask a question"), # Textbox for query
|
| 67 |
+
# outputs="textbox", # Display the generated answer in a textbox
|
| 68 |
+
# title="Answer Questions with Gemini-Pro",
|
| 69 |
+
# description="Ask a question and get an answer based on context from a ChromaDB collection.",
|
| 70 |
+
# )
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
# Define the Gradio interface
|
| 75 |
iface2 = gr.Interface(
|
| 76 |
+
fn=Show_Interface,
|
| 77 |
+
inputs=["file","text"], # Specify a file input component
|
| 78 |
outputs="textbox", # Display the output text in a textbox
|
| 79 |
+
title="Choose only one method at a time(Upload pdf /or Query from uploaded PDF)",
|
| 80 |
+
description="Choose only one method at a time(Upload pdf /or Query from uploaded PDF)",
|
| 81 |
)
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
iface2.launch(debug=True)
|
| 84 |
|
| 85 |
|