cantuncok commited on
Commit
78537cc
1 Parent(s): c78aa7e

Add application and requirements files

Browse files
Files changed (2) hide show
  1. app.py +26 -0
  2. requirements.txt +2 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Modeli yükleyin
5
+ model_name = "cantuncok/autotrain1-model"
6
+ classifier = pipeline("image-classification", model=model_name)
7
+
8
+ # Görsel sınıflandırma fonksiyonu
9
+ def classify_image(image):
10
+ # Modelden tahminleri alın
11
+ results = classifier(image)
12
+ # Tüm tahminleri ve puanlarını döndürün
13
+ return {result['label']: result['score'] for result in results}
14
+
15
+ # Gradio arayüzünü oluşturun
16
+ interface = gr.Interface(
17
+ fn=classify_image,
18
+ inputs=gr.inputs.Image(type="pil"),
19
+ outputs="label",
20
+ title="Görüntü Sınıflandırma",
21
+ description="Bu uygulama bir görüntüyü sınıflandırır ve etiketi döndürür."
22
+ )
23
+
24
+ # Uygulamayı başlatın
25
+ if __name__ == "__main__":
26
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ Pillow