Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +24 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gradio_client import Client, file
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
client = Client("mariem2024/plantID")
|
| 5 |
+
|
| 6 |
+
def predict(image):
|
| 7 |
+
try:
|
| 8 |
+
result = client.predict(
|
| 9 |
+
file(image), # Yüklenen görsel dosyası
|
| 10 |
+
api_name="/predict" # mariem2024/plantID içinde "/predict" endpoint'i tanımlı
|
| 11 |
+
)
|
| 12 |
+
return result
|
| 13 |
+
except Exception as e:
|
| 14 |
+
return f"Hata oluştu: {str(e)}"
|
| 15 |
+
|
| 16 |
+
demo = gr.Interface(
|
| 17 |
+
fn=predict,
|
| 18 |
+
inputs=gr.Image(type="filepath"),
|
| 19 |
+
outputs="text",
|
| 20 |
+
title="Bitki Tanıma",
|
| 21 |
+
description="Bu arayüz Hugging Face Space üzerinden bitki türünü tahmin eder."
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
gradio_client
|
| 3 |
+
|
| 4 |
+
|