Spaces:
Sleeping
Sleeping
Mustehson commited on
Commit ·
e2762c5
1
Parent(s): 77325f9
Added Qwen
Browse files
app.py
CHANGED
|
@@ -15,15 +15,22 @@ print('Connecting to DB...')
|
|
| 15 |
# Connect to DB
|
| 16 |
conn = duckdb.connect(f"md:my_db?motherduck_token={md_token}", read_only=True)
|
| 17 |
|
| 18 |
-
models = ["meta-llama/Meta-Llama-3-70B-Instruct",
|
| 19 |
"meta-llama/Llama-3.1-70B-Instruct"]
|
| 20 |
|
|
|
|
| 21 |
for model in models:
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
def get_schemas():
|
| 29 |
schemas = conn.execute("""
|
|
@@ -163,6 +170,7 @@ def main(table, text_query):
|
|
| 163 |
|
| 164 |
schema, table_name = get_table_schema(table)
|
| 165 |
|
|
|
|
| 166 |
try:
|
| 167 |
output = get_visualization(question=text_query, tool=tool, schema=schema, table_name=table_name)
|
| 168 |
fig = output.get('fig', None)
|
|
|
|
| 15 |
# Connect to DB
|
| 16 |
conn = duckdb.connect(f"md:my_db?motherduck_token={md_token}", read_only=True)
|
| 17 |
|
| 18 |
+
models = ["Qwen/Qwen2.5-72B-Instruct","meta-llama/Meta-Llama-3-70B-Instruct",
|
| 19 |
"meta-llama/Llama-3.1-70B-Instruct"]
|
| 20 |
|
| 21 |
+
model_loaded = False
|
| 22 |
for model in models:
|
| 23 |
+
try:
|
| 24 |
+
llm_engine = HfEngine(model=model)
|
| 25 |
+
info = llm_engine.client.get_endpoint_info()
|
| 26 |
+
model_loaded = True
|
| 27 |
+
break
|
| 28 |
+
except Exception as e:
|
| 29 |
+
print(f"Error for model {model}: {e}")
|
| 30 |
+
continue
|
| 31 |
+
|
| 32 |
+
if not model_loaded:
|
| 33 |
+
gr.Warning(f"❌ None of the model form {models} are available. {e}")
|
| 34 |
|
| 35 |
def get_schemas():
|
| 36 |
schemas = conn.execute("""
|
|
|
|
| 170 |
|
| 171 |
schema, table_name = get_table_schema(table)
|
| 172 |
|
| 173 |
+
|
| 174 |
try:
|
| 175 |
output = get_visualization(question=text_query, tool=tool, schema=schema, table_name=table_name)
|
| 176 |
fig = output.get('fig', None)
|