doc: add context to `app.py`
Browse files
app.py
CHANGED
@@ -83,7 +83,23 @@ async def interact_with_agent(message, history):
|
|
83 |
# * Initialize Gradio
|
84 |
theme = gr.themes.Ocean()
|
85 |
with gr.Blocks(theme=theme, fill_height=True) as demo:
|
86 |
-
gr.Markdown("# Formula 1 Briefing Generator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
chatbot = gr.Chatbot(
|
88 |
type="messages",
|
89 |
label="Agent interaction",
|
@@ -109,6 +125,65 @@ with gr.Blocks(theme=theme, fill_height=True) as demo:
|
|
109 |
btn.click(fn=interact_with_agent, inputs=[input, chatbot], outputs=chatbot)
|
110 |
btn.click(lambda x: gr.update(value=''), [], [input])
|
111 |
input.submit(lambda x: gr.update(value=''), [], [input])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
|
114 |
demo.launch()
|
|
|
83 |
# * Initialize Gradio
|
84 |
theme = gr.themes.Ocean()
|
85 |
with gr.Blocks(theme=theme, fill_height=True) as demo:
|
86 |
+
gr.Markdown("""# Formula 1 Briefing Generator
|
87 |
+
|
88 |
+
Welcome to the Formula 1 Briefing Generator - your AI-powered
|
89 |
+
assistant for comprehensive race analysis.
|
90 |
+
This innovative tool transforms complex Formula 1 race data into clear,
|
91 |
+
detailed reports automatically.
|
92 |
+
Whether you're interested in driver performance, tire strategies, or weather
|
93 |
+
impacts, our system analyzes telemetry data to provide insights that previously
|
94 |
+
required hours of expert analysis. This means teams, journalists, and fans
|
95 |
+
can now get instant, data-driven race breakdowns without needing technical expertise.
|
96 |
+
|
97 |
+
To use this chatbot, simply type your question in the text box below.
|
98 |
+
You can ask about specific driver performances, compare lap times between teammates,
|
99 |
+
analyze tire degradation patterns, or understand how weather conditions affected the race.
|
100 |
+
Try starting with questions like _"How did Verstappen perform in the first sector?"_ or
|
101 |
+
_"Compare the tire strategies between Mercedes drivers."_ The AI will process your request
|
102 |
+
and provide detailed answers backed by real race data.""")
|
103 |
chatbot = gr.Chatbot(
|
104 |
type="messages",
|
105 |
label="Agent interaction",
|
|
|
125 |
btn.click(fn=interact_with_agent, inputs=[input, chatbot], outputs=chatbot)
|
126 |
btn.click(lambda x: gr.update(value=''), [], [input])
|
127 |
input.submit(lambda x: gr.update(value=''), [], [input])
|
128 |
+
gr.Markdown(
|
129 |
+
"""---""")
|
130 |
+
gr.Markdown("""## How We Process Formula 1 Data
|
131 |
+
|
132 |
+
This application uses advanced AI techniques to translate your natural
|
133 |
+
language questions into precise database queries:
|
134 |
+
|
135 |
+
1. **ReAct Agent**: The system uses a ReAct (Reasoning and Acting) agent that
|
136 |
+
breaks down complex questions into logical steps. For example, when you ask about tire strategies, the agent plans how to:
|
137 |
+
- Query tire compound data
|
138 |
+
- Analyze pit stop timing
|
139 |
+
- Compare driver performances
|
140 |
+
|
141 |
+
2. **RAG (Retrieval Augmented Generation)**: We enhance our responses by retrieving
|
142 |
+
relevant telemetry data from our Formula 1 database. This includes:
|
143 |
+
- Lap times
|
144 |
+
- Sector performances
|
145 |
+
- Tire data
|
146 |
+
- Weather conditions
|
147 |
+
- Track temperatures
|
148 |
+
|
149 |
+
3. **Text-to-SQL Translation**: Your natural language questions are converted into SQL
|
150 |
+
queries that extract precise data from our telemetry database.
|
151 |
+
The LLM understands racing context and generates accurate queries to fetch relevant information.
|
152 |
+
|
153 |
+
This combination allows us to provide data-driven insights about any aspect of the race,
|
154 |
+
backed by real telemetry data.
|
155 |
+
|
156 |
+
## Next Steps
|
157 |
+
|
158 |
+
We're continuously working to enhance this application's capabilities:
|
159 |
+
|
160 |
+
1. **Expanded Race Coverage**:
|
161 |
+
- Add telemetry data from more Grand Prix events
|
162 |
+
- Include historical race data for trend analysis
|
163 |
+
- Incorporate practice and qualifying session data
|
164 |
+
|
165 |
+
2. **Vehicle Setup Database**:
|
166 |
+
- Track car setup configurations for each team
|
167 |
+
- Monitor setup changes between sessions
|
168 |
+
- Analyze correlation between setup and performance
|
169 |
+
|
170 |
+
3. **Simulator Integration**:
|
171 |
+
- Connect with racing simulators for predictive modeling
|
172 |
+
- Compare real telemetry with simulated data
|
173 |
+
- Test strategy scenarios in virtual environments
|
174 |
+
|
175 |
+
4. **Enhanced AI Capabilities**:
|
176 |
+
- Fine-tune language models on racing-specific data
|
177 |
+
- Add specialized tools for aerodynamic analysis
|
178 |
+
- Implement predictive models for race strategy
|
179 |
+
- Develop visual telemetry comparison tools
|
180 |
+
|
181 |
+
5. **Advanced Analytics**:
|
182 |
+
- Introduce machine learning for pattern recognition
|
183 |
+
- Develop tire degradation prediction models
|
184 |
+
- Add weather impact analysis tools
|
185 |
+
|
186 |
+
Checkout the source code https://github.com/Draichi/formula1-AI don't forget to star the repo!""")
|
187 |
|
188 |
|
189 |
demo.launch()
|