gpt_detect23 / app.py
Prakhar618's picture
Create app.py
6d26209 verified
raw
history blame
587 Bytes
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()