This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pinecone | |
PINECONE_API_KEY = "your_pinecone_api_key" | |
PINECONE_ENVIRONMENT = "gcp-starter" | |
PINECONE_INDEX_NAME = "your_index_name" | |
# Function to retrieve vector IDs from a query | |
def get_ids_from_query(index, input_vector): | |
results = index.query(vector=input_vector, top_k=10000, include_values=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import google.generativeai as genai | |
import tkinter as tk | |
from tkinter import filedialog | |
import os | |
import time | |
GOOGLE_API_KEY = "YOUR_API_KEY" | |
genai.configure(api_key=GOOGLE_API_KEY) | |
def generate_content_with_gemini(prompt): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gradio_client import Client | |
import os | |
import shutil | |
# https://huggingface.co/spaces/JingyeChen22/TextDiffuser-2 | |
destination_directory = 'd:\\downloads\\' | |
client = Client("https://jingyechen22-textdiffuser-2.hf.space/--replicas/snjqb/") | |
result = client.predict( | |
"-1", # str in 'guest_id' Textbox component | |
"<|startoftext|>poster of four players playing beach volleyball and net photorealistic <|endoftext|><|startoftext|> l36 t18 r90 b35 [M] [a] [l] [i] [b] [u] <|endoftext|> l38 t32 r87 b52 [B] [e] [a] [c] [h] <|endoftext|> l21 t51 r105 b76 [V] [o] [l] [l] [e] [y] [b] [a] [l] [l] <|endoftext|><|endoftext|>", # str in 'Prompt. You can let language model automatically identify keywords, or provide them below' Textbox component | |
"Malibu/Beach/Volleyball", # str in '(Optional) Keywords. Should be separated by / (e.g., keyword1/keyword2/...)' Textbox component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter as tk | |
from tkinter import filedialog, messagebox | |
import shutil | |
import datetime | |
import os | |
import json | |
# Constants | |
LAST_FOLDER_FILE = "last_folder.json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_most_common_in_sublists(lists): | |
def find_most_common(numbers): | |
if not numbers: | |
return None # Return None for empty lists | |
if isinstance(numbers, list) and all(isinstance(item, (int, str)) for item in numbers): | |
counts = {} | |
max_count = 0 | |
most_common = None | |
for item in numbers: | |
counts[item] = counts.get(item, 0) + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import math | |
import clr | |
import random # Import the random module | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
def create_pommes_duchesse_profile(base_radius, ridge_count, min_ridge_height, max_ridge_height, offset): | |
points = [] | |
angle_step = 360.0 / (ridge_count * 2) # Two points per ridge (peak and trough) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ClearList(primList): | |
result = [] | |
for sublist in primList: | |
if sublist is None or sublist == "": | |
continue | |
if isinstance(sublist, list): | |
sublist = ClearList(sublist) | |
if not sublist: | |
continue | |
result.append(sublist) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def replace_falsey_or_mark_non_falsey(items, rep): | |
elementlist = [] | |
for item in items: | |
if not item: | |
item = rep | |
else: | |
item = False | |
elementlist.append(item) | |
return elementlist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clr | |
clr.AddReference('System.Windows.Forms') | |
clr.AddReference('System.Drawing') | |
from System.Windows.Forms import Form, ListView, ListViewItem, TextBox, Button, DialogResult, CheckBox, View, AnchorStyles, Label, Panel | |
from System.Drawing import Point, Size, Color | |
def multi_select_dialog(options): | |
frm = Form() | |
frm.Width = 500 | |
frm.Height = 900 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clr | |
clr.AddReference('RevitNodes') | |
import System | |
clr.AddReference('System.Drawing') | |
from System.Drawing import Bitmap,Graphics,Font,Brushes,RectangleF | |
from System.Drawing.Drawing2D import SmoothingMode,InterpolationMode,PixelOffsetMode | |
input_folder=IN[0] | |
input_len=len(input_folder)+1 | |
output_folder=IN[1] |