File size: 864 Bytes
b06a4a8
c820f6a
b06a4a8
c452545
b06a4a8
c452545
c820f6a
d60c7b3
c452545
 
 
 
 
d60c7b3
c452545
 
b06a4a8
c452545
 
 
 
 
1e7f33c
c452545
 
b06a4a8
 
 
c452545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from transformers import pipeline
import gradio as gr

from transformers import pipeline

video_model = pipeline("video-classification", model="Rohit1412/deepfakerohit2.0")

def classify_video(video):
    # Classify the uploaded video and return the results
    predictions = video_model(video)
    
    # Create a dictionary of labels and their corresponding scores
    result = {pred["label"]: pred["score"] for pred in predictions}
    
    # Return the result dictionary
    return result

# Create Gradio interface
interface = gr.Interface(
    fn=classify_video,
    inputs=gr.Video(label="Upload Video"),
    outputs=gr.Label(num_top_classes=3, label="Predictions"),
    title="Video deepfake Classification App",
    description="Upload a video to classify its content."
)

# Launch the interface
if __name__ == "__main__":
    interface.launch(debug=True)