Upload 3 files
Browse files- .gitattributes +1 -0
- civitai.sqlite +3 -0
- look.py +43 -0
- looksearch.py +48 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
civitai.sqlite filter=lfs diff=lfs merge=lfs -text
|
civitai.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2d02e292b53d6e03b43efe20e1a6f1030b798c51c5936e0bca0887bd5214efd3
|
| 3 |
+
size 4350697472
|
look.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sqlite3
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
# --- Configuration ---
|
| 6 |
+
db_path = r'c:\Users\xcool\Downloads\civitai\civitai.sqlite'
|
| 7 |
+
|
| 8 |
+
# --- THE IMPORTANT PART ---
|
| 9 |
+
# We add a WHERE clause to filter for the exact username we want.
|
| 10 |
+
# SQL strings are enclosed in single quotes (' ').
|
| 11 |
+
search_term = "direct22202"
|
| 12 |
+
query = "SELECT * FROM models WHERE username = '{search_term}';"
|
| 13 |
+
|
| 14 |
+
# --- Script Logic ---
|
| 15 |
+
output_filename = f'search_results_for_{search_term}.csv'
|
| 16 |
+
|
| 17 |
+
if not os.path.exists(db_path):
|
| 18 |
+
print(f"Error: The file was not found at the path: {db_path}")
|
| 19 |
+
else:
|
| 20 |
+
conn = None
|
| 21 |
+
try:
|
| 22 |
+
conn = sqlite3.connect(db_path)
|
| 23 |
+
print(f"Successfully connected. Searching for models by username '{search_term}'...")
|
| 24 |
+
|
| 25 |
+
df = pd.read_sql_query(query, conn)
|
| 26 |
+
|
| 27 |
+
if df.empty:
|
| 28 |
+
print("\nNo models found for that username.")
|
| 29 |
+
else:
|
| 30 |
+
# --- Option 1: Display results directly in the terminal ---
|
| 31 |
+
print("\n--- Found Models ---")
|
| 32 |
+
print(df)
|
| 33 |
+
|
| 34 |
+
# --- Option 2: Save results to a CSV file ---
|
| 35 |
+
df.to_csv(output_filename, index=False)
|
| 36 |
+
print(f"\n✅ Success! The results have also been saved to '{output_filename}'")
|
| 37 |
+
|
| 38 |
+
except Exception as e:
|
| 39 |
+
print(f"An error occurred: {e}")
|
| 40 |
+
finally:
|
| 41 |
+
if conn:
|
| 42 |
+
conn.close()
|
| 43 |
+
print("\nDatabase connection closed.")
|
looksearch.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sqlite3
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
# --- Configuration ---
|
| 6 |
+
db_path = r'c:\Users\xcool\Downloads\civitai\civitai.sqlite'
|
| 7 |
+
|
| 8 |
+
# --- 1. SET YOUR LOOSE SEARCH TERM HERE ---
|
| 9 |
+
# This will find any model with "Corneo" anywhere in its name.
|
| 10 |
+
search_term = "Donald trump"
|
| 11 |
+
|
| 12 |
+
# --- 2. THE SQL QUERY IS BUILT FOR A LOOSE SEARCH ---
|
| 13 |
+
# The '?' is a placeholder to prevent errors and security issues (SQL injection).
|
| 14 |
+
# The LIKE operator with '%' wildcards on both sides finds the search term anywhere.
|
| 15 |
+
query = "SELECT id, name, type, username FROM models WHERE name LIKE ?;"
|
| 16 |
+
|
| 17 |
+
# --- Script Logic ---
|
| 18 |
+
output_filename = f'search_results_for_{search_term}.csv'
|
| 19 |
+
|
| 20 |
+
if not os.path.exists(db_path):
|
| 21 |
+
print(f"Error: The file was not found at the path: {db_path}")
|
| 22 |
+
else:
|
| 23 |
+
conn = None
|
| 24 |
+
try:
|
| 25 |
+
conn = sqlite3.connect(db_path)
|
| 26 |
+
print(f"Successfully connected. Searching for models with '{search_term}' in the name...")
|
| 27 |
+
|
| 28 |
+
# We pass the query and the parameters separately.
|
| 29 |
+
# The f-string formats our search term with the '%' wildcards.
|
| 30 |
+
df = pd.read_sql_query(query, conn, params=(f'%{search_term}%',))
|
| 31 |
+
|
| 32 |
+
if df.empty:
|
| 33 |
+
print(f"\nNo models found matching '{search_term}'.")
|
| 34 |
+
else:
|
| 35 |
+
print(f"\n--- Found {len(df)} Matching Models ---")
|
| 36 |
+
# Display results directly in the terminal
|
| 37 |
+
print(df)
|
| 38 |
+
|
| 39 |
+
# Save the full results to a CSV file for easy viewing
|
| 40 |
+
df.to_csv(output_filename, index=False)
|
| 41 |
+
print(f"\n✅ Success! The results have been saved to '{output_filename}'")
|
| 42 |
+
|
| 43 |
+
except Exception as e:
|
| 44 |
+
print(f"An error occurred: {e}")
|
| 45 |
+
finally:
|
| 46 |
+
if conn:
|
| 47 |
+
conn.close()
|
| 48 |
+
print("\nDatabase connection closed.")
|