Entreprenerdly commited on
Commit
0352314
1 Parent(s): 869a494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -43
app.py CHANGED
@@ -3,6 +3,7 @@ os.system("pip uninstall -y gradio")
3
  os.system("pip install gradio==3.40.1")
4
 
5
  import gradio as gr
 
6
 
7
  # Replace with your private Space's URL
8
  private_space_url = "Entreprenerdly/CandleStickScan-Stock-trading-yolov8"
@@ -11,47 +12,7 @@ private_space_url = "Entreprenerdly/CandleStickScan-Stock-trading-yolov8"
11
  access_token = os.getenv("HF_TOKEN")
12
 
13
  # Load the private Space using the gr.load() method
14
- blocks = gr.load(name=private_space_url, src="spaces", hf_token=access_token)
15
 
16
- # Define examples for images and videos
17
- image_examples = [
18
- ["test/test1.jpg", "foduucom/stockmarket-pattern-detection-yolov8", 640, 0.25, 0.45],
19
- ["test/test2.jpg", "foduucom/stockmarket-pattern-detection-yolov8", 640, 0.25, 0.45]
20
- ]
21
-
22
- video_examples = [
23
- ["test/testvideo.mp4", "foduucom/stockmarket-pattern-detection-yolov8", 640, 0.25, 0.45]
24
- ]
25
-
26
- # Extract the image and video interfaces from the loaded Blocks object
27
- image_interface = blocks.children[0]
28
- video_interface = blocks.children[1]
29
-
30
- # Create new interfaces in the public space with examples
31
- public_image_interface = gr.Interface(
32
- fn=image_interface.fn,
33
- inputs=image_interface.inputs,
34
- outputs=image_interface.outputs,
35
- title=image_interface.title,
36
- description=image_interface.description,
37
- examples=image_examples,
38
- cache_examples=False,
39
- theme='huggingface'
40
- )
41
-
42
- public_video_interface = gr.Interface(
43
- fn=video_interface.fn,
44
- inputs=video_interface.inputs,
45
- outputs=video_interface.outputs,
46
- title=video_interface.title,
47
- description=video_interface.description,
48
- examples=video_examples,
49
- cache_examples=False,
50
- theme='huggingface'
51
- )
52
-
53
- # Create a Tabbed Interface
54
- gr.TabbedInterface(
55
- [public_image_interface, public_video_interface],
56
- tab_names=['Image inference', 'Video inference']
57
- ).queue().launch()
 
3
  os.system("pip install gradio==3.40.1")
4
 
5
  import gradio as gr
6
+ import os
7
 
8
  # Replace with your private Space's URL
9
  private_space_url = "Entreprenerdly/CandleStickScan-Stock-trading-yolov8"
 
12
  access_token = os.getenv("HF_TOKEN")
13
 
14
  # Load the private Space using the gr.load() method
15
+ interface = gr.load(name=private_space_url, src="spaces", hf_token=access_token)
16
 
17
+ # Launch the interface on the specified port
18
+ interface.launch()