Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
import transformers
|
|
|
|
| 4 |
from synthid_text import detector_bayesian, synthid_mixin, logits_processing
|
| 5 |
|
|
|
|
| 6 |
# Configurations and model selection
|
| 7 |
MODEL_NAME = "google/gemma-7b-it" # Choose the model (Gemma models used in SynthID)
|
| 8 |
DEVICE = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
|
|
@@ -21,6 +23,7 @@ logits_processor = logits_processing.SynthIDLogitsProcessor(
|
|
| 21 |
)
|
| 22 |
|
| 23 |
# Function to check for AI-generated content using SynthID
|
|
|
|
| 24 |
def check_plagiarism(text):
|
| 25 |
# Tokenize and process the input text
|
| 26 |
tokens = tokenizer.encode_plus(text, return_tensors="pt", truncation=True, padding=True)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
import transformers
|
| 4 |
+
import spaces
|
| 5 |
from synthid_text import detector_bayesian, synthid_mixin, logits_processing
|
| 6 |
|
| 7 |
+
|
| 8 |
# Configurations and model selection
|
| 9 |
MODEL_NAME = "google/gemma-7b-it" # Choose the model (Gemma models used in SynthID)
|
| 10 |
DEVICE = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
|
|
|
|
| 23 |
)
|
| 24 |
|
| 25 |
# Function to check for AI-generated content using SynthID
|
| 26 |
+
@spaces.GPU
|
| 27 |
def check_plagiarism(text):
|
| 28 |
# Tokenize and process the input text
|
| 29 |
tokens = tokenizer.encode_plus(text, return_tensors="pt", truncation=True, padding=True)
|