nehulagrawal's picture
Update app.py
8241fcd
raw
history blame
3.06 kB
import gradio as gr
import cv2
import requests
import os
from ultralyticsplus import YOLO, render_result
# Model Heading and Description
model_heading = "StockMarket: Trends Recognition for Trading Success"
description = """ 🌟 Elevate Your Trading Odyssey with Trend Predictions! 🌟
Dive deep into the enigma of market trends with the precision of a seasoned detective. πŸ•΅οΈβ€β™‚οΈ With Foduu AI's unparalleled insights, transition seamlessly from bearish 'Downs' to bullish 'Ups'. πŸ“‰πŸ“ˆ
Consider us your trading compass, guiding you through the financial wilderness like a modern-day Gandalf. πŸ§™β€β™‚οΈ Whether you're a seasoned trader or just embarking on your journey, we're here to illuminate your path. πŸ’‘
Trading with us? It's like possessing the secret recipe to investment success. πŸ²πŸ’°
Intrigued? Dive into the world of trading alchemy! 🌌
πŸ’Œ Reach Out: [email protected]
πŸ‘ Give us a thumbs up and embark on an unparalleled trading escapade! No, you won't gain superpowers, but you'll be one step closer to mastering the markets! πŸš€πŸŒπŸ“Š!"""
image_path= [['test/1.jpg', 'foduucom/stockmarket-future-prediction', 640, 0.25, 0.45], ['test/2.jpg', 'foduucom/stockmarket-future-prediction', 640, 0.25, 0.45],['test/3.jpg', 'foduucom/stockmarket-future-prediction', 640, 0.25, 0.45]]
# Load YOLO model
model = YOLO("foduucom/stockmarket-future-prediction")
#############################################################Image Inference############################################################
def yolov8_img_inference(
image: gr.inputs.Image = None,
model_path: gr.inputs.Dropdown = None,
image_size: gr.inputs.Slider = 640,
conf_threshold: gr.inputs.Slider = 0.25,
iou_threshold: gr.inputs.Slider = 0.45
):
model = YOLO(model_path)
model.overrides['conf'] = conf_threshold
model.overrides['iou']= iou_threshold
model.overrides['agnostic_nms'] = False # NMS class-agnostic
model.overrides['max_det'] = 1000
#image = read_image(image)
results = model.predict(image)
render = render_result(model=model, image=image, result=results[0])
return render
inputs_image = [
gr.inputs.Image(type="filepath", label="Input Image"),
gr.inputs.Dropdown(["foduucom/stockmarket-future-prediction"],
default="foduucom/stockmarket-future-prediction", label="Model"),
gr.inputs.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
gr.inputs.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
]
outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
interface_image = gr.Interface(
fn=yolov8_img_inference,
inputs=inputs_image,
outputs=outputs_image,
title=model_heading,
description=description,
examples=image_path,
cache_examples=False,
theme='huggingface'
)
interface_image.launch(debug=True, enable_queue=True)