File size: 1,032 Bytes
33bdf0e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from generate_scenario.final import GENETRAFFICAPI

def greet(general, event):


    description = general
    moving_description = event
    curr_map = "Town10HD"
    gen = GENETRAFFICAPI(description, moving_description, curr_map)
    res = gen.generate_xosc()
    return res


demo = gr.Interface(
    fn=greet,
    inputs=[gr.Textbox(lines=2, placeholder="Scenario Description General:"),
            gr.Textbox(lines=2, placeholder="Scenario Description Event:"),],
    outputs="text",
)
demo.launch()

# the Vehicle A was traveling normally on the road, when vehicle B rear-ended vehicle A.
# Vehicle carA is driving normally. Later, carA will turn left and vehicle carB, traveling in the opposite direction on a different lane, will have collision with carA. Additionally, on the same lane of carA, carC is driving normally on the rear of carA
# Event1: the adversary car move with speed 27 when it's at the distance of 21 from hero car. Event2:the adversary car stop when the collision happen on hero car.