solve const issue
Browse files- README.md +1 -12
- app.py +3 -1
- patch_gradio.py +18 -0
README.md
CHANGED
@@ -1,12 +1 @@
|
|
1 |
-
|
2 |
-
title: QueryMind
|
3 |
-
emoji: 💬
|
4 |
-
colorFrom: yellow
|
5 |
-
colorTo: purple
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: 5.0.1
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
|
|
1 |
+
# QueryMind
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
|
|
2 |
from pathlib import Path
|
3 |
from tempfile import mkdtemp
|
4 |
|
|
|
|
|
5 |
# LangChain & Embedding/LLM
|
6 |
from langchain_community.vectorstores import FAISS
|
7 |
from langchain_huggingface.embeddings import HuggingFaceEmbeddings
|
@@ -236,4 +238,4 @@ with gr.Blocks() as app:
|
|
236 |
)
|
237 |
|
238 |
if __name__ == "__main__":
|
239 |
-
app.launch()
|
|
|
2 |
from pathlib import Path
|
3 |
from tempfile import mkdtemp
|
4 |
|
5 |
+
import patch_gradio
|
6 |
+
|
7 |
# LangChain & Embedding/LLM
|
8 |
from langchain_community.vectorstores import FAISS
|
9 |
from langchain_huggingface.embeddings import HuggingFaceEmbeddings
|
|
|
238 |
)
|
239 |
|
240 |
if __name__ == "__main__":
|
241 |
+
app.launch(debug=True)
|
patch_gradio.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Create a file called patch_gradio.py
|
2 |
+
from types import MethodType
|
3 |
+
import gradio_client.utils
|
4 |
+
|
5 |
+
# Store the original function
|
6 |
+
original_get_type = gradio_client.utils.get_type
|
7 |
+
|
8 |
+
# Define the patched function
|
9 |
+
def patched_get_type(self, schema):
|
10 |
+
# Add type checking before using 'in' operator
|
11 |
+
if not isinstance(schema, dict):
|
12 |
+
return str(schema) # Convert to string as fallback
|
13 |
+
|
14 |
+
# Original function logic
|
15 |
+
return original_get_type(self, schema)
|
16 |
+
|
17 |
+
# Apply the patch
|
18 |
+
gradio_client.utils.get_type = MethodType(patched_get_type, gradio_client.utils)
|