siranida's picture
Upload app.py
7724858 verified
raw
history blame contribute delete
706 Bytes
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()