Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,6 +40,89 @@ scheduler.start()
|
|
| 40 |
# Initial authentication
|
| 41 |
refresh_authentication()
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
# Initialize vectorstore
|
| 44 |
vectorstore = Weaviate(client, index_name="HereChat", text_key="text")
|
| 45 |
vectorstore._query_attrs = ["text", "title", "url", "views", "lang", "_additional {distance}"]
|
|
@@ -143,4 +226,4 @@ iface = gr.Interface(
|
|
| 143 |
outputs="text"
|
| 144 |
)
|
| 145 |
|
| 146 |
-
iface.launch()
|
|
|
|
| 40 |
# Initial authentication
|
| 41 |
refresh_authentication()
|
| 42 |
|
| 43 |
+
Article = {
|
| 44 |
+
"class": "Article",
|
| 45 |
+
"description": "A class representing articles in the application",
|
| 46 |
+
"vectorIndexType": "hnsw",
|
| 47 |
+
"vectorIndexConfig": {
|
| 48 |
+
},
|
| 49 |
+
"vectorizer": "text2vec-contextionary",
|
| 50 |
+
"moduleConfig": {
|
| 51 |
+
"text2vec-contextionary": {
|
| 52 |
+
"vectorizeClassName": true
|
| 53 |
+
}
|
| 54 |
+
},
|
| 55 |
+
"properties": [
|
| 56 |
+
{
|
| 57 |
+
"name": "title",
|
| 58 |
+
"description": "The title of the article",
|
| 59 |
+
"dataType": ["text"],
|
| 60 |
+
"moduleConfig": {
|
| 61 |
+
"text2vec-contextionary": {
|
| 62 |
+
"skip": false,
|
| 63 |
+
"vectorizePropertyName": true
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"indexFilterable": true,
|
| 67 |
+
"indexSearchable": true
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"name": "content",
|
| 71 |
+
"description": "The content of the article",
|
| 72 |
+
"dataType": ["text"],
|
| 73 |
+
"moduleConfig": {
|
| 74 |
+
"text2vec-contextionary": {
|
| 75 |
+
"skip": false,
|
| 76 |
+
"vectorizePropertyName": true
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"indexFilterable": true,
|
| 80 |
+
"indexSearchable": true
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"name": "author",
|
| 84 |
+
"description": "The author of the article",
|
| 85 |
+
"dataType": ["text"],
|
| 86 |
+
"indexFilterable": true,
|
| 87 |
+
"indexSearchable": true
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"name": "publishDate",
|
| 91 |
+
"description": "The date the article was published",
|
| 92 |
+
"dataType": ["date"],
|
| 93 |
+
"indexFilterable": true,
|
| 94 |
+
"indexSearchable": true
|
| 95 |
+
}
|
| 96 |
+
],
|
| 97 |
+
"invertedIndexConfig": {
|
| 98 |
+
"stopwords": {
|
| 99 |
+
"preset": "en",
|
| 100 |
+
"additions": [],
|
| 101 |
+
"removals": []
|
| 102 |
+
},
|
| 103 |
+
"indexTimestamps": true,
|
| 104 |
+
"indexNullState": true,
|
| 105 |
+
"indexPropertyLength": true,
|
| 106 |
+
"bm25": {
|
| 107 |
+
"b": 0.75,
|
| 108 |
+
"k1": 1.2
|
| 109 |
+
}
|
| 110 |
+
},
|
| 111 |
+
"shardingConfig": {
|
| 112 |
+
"virtualPerPhysical": 128,
|
| 113 |
+
"desiredCount": 1,
|
| 114 |
+
"actualCount": 1,
|
| 115 |
+
"desiredVirtualCount": 128,
|
| 116 |
+
"actualVirtualCount": 128,
|
| 117 |
+
"key": "_id",
|
| 118 |
+
"strategy": "hash",
|
| 119 |
+
"function": "murmur3"
|
| 120 |
+
},
|
| 121 |
+
"multiTenancyConfig": {
|
| 122 |
+
"enabled": false
|
| 123 |
+
}
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
# Initialize vectorstore
|
| 127 |
vectorstore = Weaviate(client, index_name="HereChat", text_key="text")
|
| 128 |
vectorstore._query_attrs = ["text", "title", "url", "views", "lang", "_additional {distance}"]
|
|
|
|
| 226 |
outputs="text"
|
| 227 |
)
|
| 228 |
|
| 229 |
+
iface.launch()
|