Spaces:
Runtime error
Runtime error
atifsial123
commited on
Commit
•
71db3e6
1
Parent(s):
a21cc8f
Update app.py
Browse files
app.py
CHANGED
@@ -61,8 +61,8 @@ def train_model(df):
|
|
61 |
train_df, test_df = train_test_split(df, test_size=0.2, random_state=42)
|
62 |
|
63 |
# Load your pre-trained model and tokenizer from Hugging Face
|
64 |
-
tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-multilingual-base")
|
65 |
-
model = AutoModel.from_pretrained("Alibaba-NLP/gte-multilingual-base")
|
66 |
|
67 |
# Add your training code here
|
68 |
# This may involve tokenizing the data and feeding it into the model
|
@@ -71,8 +71,8 @@ def train_model(df):
|
|
71 |
# Define the Gradio interface function
|
72 |
def predict(input_text):
|
73 |
# Load the model and tokenizer
|
74 |
-
tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-multilingual-base")
|
75 |
-
model = AutoModel.from_pretrained("Alibaba-NLP/gte-multilingual-base")
|
76 |
|
77 |
# Tokenize input and make predictions
|
78 |
inputs = tokenizer(input_text, return_tensors="pt")
|
@@ -108,6 +108,3 @@ if __name__ == "__main__":
|
|
108 |
else:
|
109 |
print("Failed to build the Gradio interface. Please check the dataset and model.")
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
61 |
train_df, test_df = train_test_split(df, test_size=0.2, random_state=42)
|
62 |
|
63 |
# Load your pre-trained model and tokenizer from Hugging Face
|
64 |
+
tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-multilingual-base", trust_remote_code=True)
|
65 |
+
model = AutoModel.from_pretrained("Alibaba-NLP/gte-multilingual-base", trust_remote_code=True)
|
66 |
|
67 |
# Add your training code here
|
68 |
# This may involve tokenizing the data and feeding it into the model
|
|
|
71 |
# Define the Gradio interface function
|
72 |
def predict(input_text):
|
73 |
# Load the model and tokenizer
|
74 |
+
tokenizer = AutoTokenizer.from_pretrained("Alibaba-NLP/gte-multilingual-base", trust_remote_code=True)
|
75 |
+
model = AutoModel.from_pretrained("Alibaba-NLP/gte-multilingual-base", trust_remote_code=True)
|
76 |
|
77 |
# Tokenize input and make predictions
|
78 |
inputs = tokenizer(input_text, return_tensors="pt")
|
|
|
108 |
else:
|
109 |
print("Failed to build the Gradio interface. Please check the dataset and model.")
|
110 |
|
|
|
|
|
|