Spaces:
Runtime error
Runtime error
File size: 587 Bytes
6d26209 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
from transformers import pipeline
classifier = pipeline("text_classification", model="Prakhar618/Gptdetect")
def predict(text):
# Convert test dataframe to Hugging Face dataset
test_dataset = Dataset.from_pandas(text)
# Apply the tokenization function to the train dataset
train_dataset = test_dataset.map(tokenize_function, batched=True,)
predictions, label_probs, _ = trainer.predict(train_dataset1)
y_pred = np.argmax(predictions, axis=1)
return y_pred
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
iface.launch() |