Spaces:
Sleeping
Sleeping
File size: 706 Bytes
7724858 |
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 gradio_client import Client, file
import gradio as gr
import os
HEADERS = {
"Authorization": f"Bearer {os.environ['HF_TOKEN']}"
}
client = Client("mariem2024/plantID")
def predict(image_path):
try:
result = client.predict(
file(image_path), # Doğru: gradio `filepath` tipini dosya nesnesine dönüştürüyor
api_name="/predict"
)
return result
except Exception as e:
return f"Hata oluştu: {str(e)}"
demo = gr.Interface(
fn=predict,
inputs=gr.Image(type="filepath"),
outputs="text",
title="Bitki Tanıma",
description="Bu arayüz Hugging Face Space üzerinden bitki türünü tahmin eder."
)
demo.launch()
|