nehulagrawal commited on
Commit
7701eda
β€’
1 Parent(s): fc3f959

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -5,31 +5,30 @@ import os
5
 
6
  from ultralyticsplus import YOLO, render_result
7
 
8
- file_urls = [
9
- 'https://huggingface.co/spaces/foduucom/CandleStickScan-Stock-trading-yolov8/resolve/main/test/-2022-06-28-12-35-50_png.rf.8dee4bb645ea8b5036721b830d2636b1.jpg',
10
- 'https://huggingface.co/spaces/foduucom/CandleStickScan-Stock-trading-yolov8/resolve/main/test/-2022-06-28-12-45-10_png.rf.8b9177546e62a2422ad603b16f1f50b9.jpg',
11
- 'https://www.dropbox.com/s/7sjfwncffg8xej2/video_7.mp4?dl=1'
12
- ]
13
- description=""" πŸ•―οΈ Introducing CandleScan by Foduu AI πŸ•―οΈ
14
-
15
  Unleash the power of precise pattern recognition with CandleScan, your ultimate companion for deciphering intricate candlestick formations in the world of trading. πŸ“ŠπŸ“ˆ
16
-
17
  Unlock the secrets of successful trading by effortlessly identifying crucial candlestick patterns such as 'Head and Shoulders Bottom', 'Head and Shoulders Top', 'M-Head', 'StockLine', 'Triangle', and 'W-Bottom'. πŸ“‰πŸ“ˆ
18
-
19
  Powered by the cutting-edge technology of Foduu AI, CandleScan is your expert guide to navigating the complexities of the market. Whether you're an experienced trader or a novice investor, our app empowers you to make informed decisions with confidence. πŸ’ΌπŸ’°
20
-
21
  But that's not all! CandleScan is just the beginning. If you're hungry for more pattern recognition prowess, simply reach out to us at info@foddu.com. Our dedicated team is ready to assist you in expanding your trading horizons by integrating additional pattern recognition features. πŸ“¬πŸ“²
22
-
23
  Show your appreciation for this space-age tool by hitting the 'Like' button and start embarking on a journey towards trading mastery with CandleScan! πŸš€πŸ•―οΈπŸ“ˆ
24
-
25
  πŸ“§ Contact us: info@foddu.com
26
  πŸ‘ Like | """
 
27
  def download_file(url, save_name):
28
  url = url
29
  if not os.path.exists(save_name):
30
  file = requests.get(url)
31
  open(save_name, 'wb').write(file.content)
32
 
 
 
 
 
 
 
 
33
  for i, url in enumerate(file_urls):
34
  if 'mp4' in file_urls[i]:
35
  download_file(
@@ -42,10 +41,10 @@ for i, url in enumerate(file_urls):
42
  # f"image_{i}.jpg"
43
  # )
44
 
 
45
  model = YOLO('foduucom/stockmarket-pattern-detection-yolov8')
46
- path = [['test/test1.jpg'], ['test/test2.jpg']]
47
- video_path = [['video.mp4']]
48
 
 
49
  def show_preds_image(image_path):
50
  image = cv2.imread(image_path)
51
  outputs = model.predict(source=image_path)
@@ -71,12 +70,13 @@ interface_image = gr.Interface(
71
  fn=show_preds_image,
72
  inputs=inputs_image,
73
  outputs=outputs_image,
74
- title="CandleStickScan: Pattern Recognition for Trading Success",
75
  descripiton=description,
76
  examples=path,
77
  cache_examples=False,
78
  )
79
 
 
80
  def show_preds_video(video_path):
81
  cap = cv2.VideoCapture(video_path)
82
  while(cap.isOpened()):
@@ -108,7 +108,7 @@ interface_video = gr.Interface(
108
  fn=show_preds_video,
109
  inputs=inputs_video,
110
  outputs=outputs_video,
111
- title="CandleStickScan: Pattern Recognition for Trading Success",
112
  descripiton=description,
113
  examples=video_path,
114
  cache_examples=False,
@@ -117,4 +117,4 @@ interface_video = gr.Interface(
117
  gr.TabbedInterface(
118
  [interface_image, interface_video],
119
  tab_names=['Image inference', 'Video inference']
120
- ).queue().launch()
 
5
 
6
  from ultralyticsplus import YOLO, render_result
7
 
8
+ # Model Heading and Description
9
+ model_heading = "CandleStickScan: Pattern Recognition for Trading Success"
10
+ description = """ πŸ•―οΈ Introducing CandleScan by Foduu AI πŸ•―οΈ
 
 
 
 
11
  Unleash the power of precise pattern recognition with CandleScan, your ultimate companion for deciphering intricate candlestick formations in the world of trading. πŸ“ŠπŸ“ˆ
 
12
  Unlock the secrets of successful trading by effortlessly identifying crucial candlestick patterns such as 'Head and Shoulders Bottom', 'Head and Shoulders Top', 'M-Head', 'StockLine', 'Triangle', and 'W-Bottom'. πŸ“‰πŸ“ˆ
 
13
  Powered by the cutting-edge technology of Foduu AI, CandleScan is your expert guide to navigating the complexities of the market. Whether you're an experienced trader or a novice investor, our app empowers you to make informed decisions with confidence. πŸ’ΌπŸ’°
 
14
  But that's not all! CandleScan is just the beginning. If you're hungry for more pattern recognition prowess, simply reach out to us at info@foddu.com. Our dedicated team is ready to assist you in expanding your trading horizons by integrating additional pattern recognition features. πŸ“¬πŸ“²
 
15
  Show your appreciation for this space-age tool by hitting the 'Like' button and start embarking on a journey towards trading mastery with CandleScan! πŸš€πŸ•―οΈπŸ“ˆ
 
16
  πŸ“§ Contact us: info@foddu.com
17
  πŸ‘ Like | """
18
+
19
  def download_file(url, save_name):
20
  url = url
21
  if not os.path.exists(save_name):
22
  file = requests.get(url)
23
  open(save_name, 'wb').write(file.content)
24
 
25
+ # Download files
26
+ file_urls = [
27
+ 'https://huggingface.co/spaces/foduucom/CandleStickScan-Stock-trading-yolov8/resolve/main/test/-2022-06-28-12-35-50_png.rf.8dee4bb645ea8b5036721b830d2636b1.jpg',
28
+ 'https://huggingface.co/spaces/foduucom/CandleStickScan-Stock-trading-yolov8/resolve/main/test/-2022-06-28-12-45-10_png.rf.8b9177546e62a2422ad603b16f1f50b9.jpg',
29
+ 'https://www.dropbox.com/s/7sjfwncffg8xej2/video_7.mp4?dl=1'
30
+ ]
31
+
32
  for i, url in enumerate(file_urls):
33
  if 'mp4' in file_urls[i]:
34
  download_file(
 
41
  # f"image_{i}.jpg"
42
  # )
43
 
44
+ # Load YOLO model
45
  model = YOLO('foduucom/stockmarket-pattern-detection-yolov8')
 
 
46
 
47
+ # Image Inference
48
  def show_preds_image(image_path):
49
  image = cv2.imread(image_path)
50
  outputs = model.predict(source=image_path)
 
70
  fn=show_preds_image,
71
  inputs=inputs_image,
72
  outputs=outputs_image,
73
+ title=model_heading,
74
  descripiton=description,
75
  examples=path,
76
  cache_examples=False,
77
  )
78
 
79
+ # Video Inference
80
  def show_preds_video(video_path):
81
  cap = cv2.VideoCapture(video_path)
82
  while(cap.isOpened()):
 
108
  fn=show_preds_video,
109
  inputs=inputs_video,
110
  outputs=outputs_video,
111
+ title=model_heading,
112
  descripiton=description,
113
  examples=video_path,
114
  cache_examples=False,
 
117
  gr.TabbedInterface(
118
  [interface_image, interface_video],
119
  tab_names=['Image inference', 'Video inference']
120
+ ).queue().launch()