Spaces:
Sleeping
Sleeping
File size: 794 Bytes
c46c672 22a9bc1 c46c672 3edf187 22a9bc1 3edf187 22a9bc1 e36a241 60c94e7 3edf187 |
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 |
import gradio as gr
import requests
from PIL import Image
def load_model(model_name):
# Use the Hugging Face API to load the model
api_url = f"https://huggingface.co/{model_name}"
response = requests.get(api_url)
if response.status_code == 200:
# Assume the model is an image processing model
return lambda image: image # Replace with actual model processing code
else:
raise ValueError("Model not found")
# Load the model once during initialization
model = load_model("amjadfqs/finalProject")
def predict(image):
# Use the model to make a prediction
return model(image)
# Set up the Gradio interface
image_cp = gr.Image(type="pil", label='Brain')
interface = gr.Interface(fn=predict, inputs=image_cp, outputs="text")
interface.launch()
|