Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Pakai model yang masih tersedia (public) | |
| classifier = pipeline("image-classification", model="orpatashnik/StyleGAN-nada-detector") | |
| def detect_ai(image): | |
| results = classifier(image) | |
| label = results[0]['label'] | |
| score = results[0]['score'] | |
| if "real" in label.lower(): | |
| return f"π Foto Asli (confidence: {score:.2f})" | |
| else: | |
| return f"π€ Gambar AI (confidence: {score:.2f})" | |
| # Buat interface Gradio | |
| demo = gr.Interface( | |
| fn=detect_ai, | |
| inputs=gr.Image(type="pil", label="Upload Gambar"), | |
| outputs=gr.Textbox(label="Hasil Deteksi"), | |
| title="AI Image Detector", | |
| description="Upload gambar untuk mendeteksi apakah gambar asli atau buatan AI." | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |