Spaces:
Runtime error
Runtime error
Update sdk version in README to 4.15.0
Browse files
README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
---
|
2 |
title: Document Answering
|
3 |
-
emoji:
|
4 |
colorFrom: gray
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
|
|
1 |
---
|
2 |
title: Document Answering
|
3 |
+
emoji: π
|
4 |
colorFrom: gray
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.15.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
app.py
CHANGED
@@ -14,7 +14,7 @@ uploaded_df = gr.Dataframe(headers=["file_name", "content_length"])
|
|
14 |
upload_files_section = gr.Files(
|
15 |
file_types=[".md", ".mdx", ".rst", ".txt"],
|
16 |
)
|
17 |
-
chatbot_stream = gr.Chatbot(bubble_full_width=False, show_copy_button=True
|
18 |
|
19 |
|
20 |
def load_docs(files):
|
@@ -100,6 +100,13 @@ def predict(message, history):
|
|
100 |
# return format_answer
|
101 |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
vector_db = get_vector_db()
|
104 |
llm_model = get_llm_model(vector_db)
|
105 |
|
@@ -124,6 +131,7 @@ with gr.Blocks() as blocks:
|
|
124 |
)
|
125 |
# upload_files_section.upload(load_docs, inputs=upload_files_section)
|
126 |
with gr.Column(scale=4, min_width=600) as chat_col:
|
|
|
127 |
chat_interface_stream.render()
|
128 |
|
129 |
blocks.queue().launch()
|
|
|
14 |
upload_files_section = gr.Files(
|
15 |
file_types=[".md", ".mdx", ".rst", ".txt"],
|
16 |
)
|
17 |
+
chatbot_stream = gr.Chatbot(bubble_full_width=False, show_copy_button=True)
|
18 |
|
19 |
|
20 |
def load_docs(files):
|
|
|
100 |
# return format_answer
|
101 |
|
102 |
|
103 |
+
def vote(data: gr.LikeData):
|
104 |
+
if data.liked:
|
105 |
+
gr.Info("You upvoted this response π", )
|
106 |
+
else:
|
107 |
+
gr.Warning("You downvoted this response π")
|
108 |
+
|
109 |
+
|
110 |
vector_db = get_vector_db()
|
111 |
llm_model = get_llm_model(vector_db)
|
112 |
|
|
|
131 |
)
|
132 |
# upload_files_section.upload(load_docs, inputs=upload_files_section)
|
133 |
with gr.Column(scale=4, min_width=600) as chat_col:
|
134 |
+
chatbot_stream.like(vote, None, None)
|
135 |
chat_interface_stream.render()
|
136 |
|
137 |
blocks.queue().launch()
|