mirror of
https://github.com/AI4Finance-Foundation/FinGPT.git
synced 2024-02-15 23:10:01 +03:00
selenium works; stick to ChromeDriverManager
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chromium.service import ChromiumService
|
||||
from webdriver_manager.chrome import ChromeDriverManager
|
||||
|
||||
# Set up ChromeOptions
|
||||
options = webdriver.ChromeOptions()
|
||||
# options.binary_location = "/Users/tianyu/Desktop/Coding/Network/chrome/chrome-mac-arm64"
|
||||
|
||||
# Start Chrome using a specific ChromeDriver
|
||||
executable_path='/Users/tianyu/Desktop/Coding/Network/chrome/chromedriver-mac-arm64'
|
||||
executable_path=ChromeDriverManager().install()
|
||||
service=ChromiumService(executable_path=executable_path)
|
||||
driver = webdriver.Chrome(service=service, options=options)
|
||||
|
||||
# Now you can use the driver object to interact with the browser
|
||||
driver.get('https://www.google.com')
|
||||
print(driver.title)
|
||||
driver.quit()
|
||||
@@ -8,7 +8,7 @@ from external_LLMs import external_LLMs
|
||||
import pandas as pd
|
||||
import openai
|
||||
from datasets import load_dataset
|
||||
from sklearn.metrics import accuracy_score, f1_score,confusion_matrix
|
||||
from sklearn.metrics import accuracy_score, f1_score, recall_score, precision_score
|
||||
from tqdm import tqdm
|
||||
|
||||
try:
|
||||
@@ -33,12 +33,15 @@ try:
|
||||
df = df.dropna(subset=[actual_classifications_column, predicted_classifications_column])
|
||||
df[actual_classifications_column] = df[actual_classifications_column].astype(int)
|
||||
df[predicted_classifications_column] = df[predicted_classifications_column].astype(int)
|
||||
computed_f1 = f1_score(df[actual_classifications_column], df[predicted_classifications_column], average='micro')
|
||||
computed_f1 = f1_score(df[actual_classifications_column], df[predicted_classifications_column], average=None)
|
||||
computed_accuracy_score = accuracy_score(df[actual_classifications_column], df[predicted_classifications_column])
|
||||
|
||||
computed_precision_score = precision_score(df[actual_classifications_column], df[predicted_classifications_column], average=None)
|
||||
computed_recall_score = recall_score(df[actual_classifications_column], df[predicted_classifications_column], average=None)
|
||||
|
||||
print("f1 score: ", computed_f1)
|
||||
print("accuracy score: ", computed_accuracy_score)
|
||||
print("precision score: ", computed_precision_score)
|
||||
print("recall score: ", computed_recall_score)
|
||||
|
||||
except Exception as e:
|
||||
gui.exceptionbox(str(e))
|
||||
@@ -23,23 +23,23 @@ def find_different_rows():
|
||||
else:
|
||||
gui.msgbox("No rows found without 'http' in 'link' column.")
|
||||
|
||||
# if file_path:
|
||||
# # Read CSV file using pandas
|
||||
# df = pd.read_csv(file_path)
|
||||
#
|
||||
# # Ensure "text" and "contextualized sentences" columns exist
|
||||
# if "text" not in df.columns or "contextualized_sentence" not in df.columns:
|
||||
# gui.msgbox("Either or both 'text' and 'contextualized_sentences' columns are missing.")
|
||||
# return
|
||||
#
|
||||
# # Find rows where "text" and "contextualized sentences" values are different
|
||||
# different_rows = df[df['text'] != df['contextualized_sentence']]
|
||||
#
|
||||
# # Report the different row indexes
|
||||
# if not different_rows.empty:
|
||||
# gui.msgbox("total number is {}".format(len(different_rows.index.tolist())))
|
||||
# else:
|
||||
# gui.msgbox("No rows found with different values for 'text' and 'contextualized_sentences'.")
|
||||
if file_path:
|
||||
# Read CSV file using pandas
|
||||
df = pd.read_csv(file_path)
|
||||
|
||||
# Ensure "text" and "contextualized sentences" columns exist
|
||||
if "text" not in df.columns or "contextualized_sentence" not in df.columns:
|
||||
gui.msgbox("Either or both 'text' and 'contextualized_sentences' columns are missing.")
|
||||
return
|
||||
|
||||
# Find rows where "text" and "contextualized sentences" values are different
|
||||
different_rows = df[df['text'] != df['contextualized_sentence']]
|
||||
|
||||
# Report the different row indexes
|
||||
if not different_rows.empty:
|
||||
gui.msgbox("total number is {}".format(len(different_rows.index.tolist())))
|
||||
else:
|
||||
gui.msgbox("No rows found with different values for 'text' and 'contextualized_sentences'.")
|
||||
|
||||
else:
|
||||
gui.msgbox("No file selected.")
|
||||
Reference in New Issue
Block a user