luet commited on
Commit
cb8f33f
·
1 Parent(s): ee4435a
Files changed (2) hide show
  1. app.py +52 -4
  2. models.json +0 -15
app.py CHANGED
@@ -41,22 +41,38 @@ def display_models(developer=None, use_case=None, year_range=None):
41
  start_year, end_year = year_range
42
  models = [m for m in models if start_year <= int(m['dateOfRelease'][:4]) <= end_year]
43
 
44
- models = sorted(models, key=lambda x: x['dateOfRelease']) # Sort by release date
45
- models = calculate_time_difference(models) # Calculate time differences
 
 
46
 
47
  output = "<div style='display: flex; flex-direction: column; align-items: flex-start; gap: 20px;'>"
48
- for model in models:
49
  time_gap = model.get('time_difference', 0) * 2 # Scale time gap for visualization
50
- output += f"<div style='margin-top: {time_gap}px; border: 1px solid #ccc; border-radius: 10px; padding: 10px; width: 90%; background: linear-gradient(135deg, #f9f9f9, #e9e9e9); box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);'>"
 
 
 
 
 
 
 
 
 
 
 
51
  output += f"<h3 style='color: #2d89ef;'>{model['name']} ({model['dateOfRelease']})</h3>"
52
  output += f"<p><strong>Description:</strong> {model['description']}</p>"
53
  output += f"<p><strong>Developer:</strong> {model.get('developer', 'Unknown')}</p>"
54
  output += f"<p><strong>Use Case:</strong> {model.get('use_case', 'General')}</p>"
55
  output += f"<p><strong>Impact:</strong> {model.get('impact', 'Not specified')}</p>"
56
  output += "</div>"
 
 
57
  output += "</div>"
58
  return output
59
 
 
60
  # Function to add a new model
61
  def add_model(name, description, dateOfRelease, developer, use_case, impact):
62
  models = load_models()
@@ -87,6 +103,10 @@ def edit_model(index, name, description, dateOfRelease, developer, use_case, imp
87
  save_models(models)
88
  return "Model updated successfully!", display_models()
89
 
 
 
 
 
90
  # Gradio interface
91
  with gr.Blocks(css="""
92
  body {
@@ -116,8 +136,36 @@ with gr.Blocks(css="""
116
  color: white; /* White text */
117
  border: 1px solid #555; /* Lighter border */
118
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  """) as app:
120
  gr.Markdown("# AI Timeline\n\nVisualize the development of AI models through an interactive timeline.")
 
 
 
 
121
 
122
  with gr.Tab("View Timeline"):
123
  with gr.Row():
 
41
  start_year, end_year = year_range
42
  models = [m for m in models if start_year <= int(m['dateOfRelease'][:4]) <= end_year]
43
 
44
+ models = sorted(models, key=lambda x: x['dateOfRelease'], reverse=True) # Sort by release date
45
+
46
+ # Calculate time differences before using them
47
+ models = calculate_time_difference(models) # Ensure time differences are calculated here
48
 
49
  output = "<div style='display: flex; flex-direction: column; align-items: flex-start; gap: 20px;'>"
50
+ for i, model in enumerate(models):
51
  time_gap = model.get('time_difference', 0) * 2 # Scale time gap for visualization
52
+
53
+ if i < len(models) - 1: # To show time difference text only between cards, not after the last one
54
+ # Safely access the time difference and display it
55
+ time_diff = model.get('time_difference', None)
56
+ if time_diff is not None:
57
+ time_diff_text = f"<div style='color: #ccc; font-style: italic;'>"
58
+ time_diff_text += f"{time_diff} days between releases</div>"
59
+ output += time_diff_text
60
+
61
+ # Add the model card with the time gap applied between models
62
+ # output += f"<div class='ai-card' style='margin-top: {time_gap}px;'>"
63
+ output += f"<div class='ai-card'>"
64
  output += f"<h3 style='color: #2d89ef;'>{model['name']} ({model['dateOfRelease']})</h3>"
65
  output += f"<p><strong>Description:</strong> {model['description']}</p>"
66
  output += f"<p><strong>Developer:</strong> {model.get('developer', 'Unknown')}</p>"
67
  output += f"<p><strong>Use Case:</strong> {model.get('use_case', 'General')}</p>"
68
  output += f"<p><strong>Impact:</strong> {model.get('impact', 'Not specified')}</p>"
69
  output += "</div>"
70
+
71
+
72
  output += "</div>"
73
  return output
74
 
75
+
76
  # Function to add a new model
77
  def add_model(name, description, dateOfRelease, developer, use_case, impact):
78
  models = load_models()
 
103
  save_models(models)
104
  return "Model updated successfully!", display_models()
105
 
106
+ # Get the current month
107
+ def get_current_month():
108
+ return datetime.now().strftime("%B %Y")
109
+
110
  # Gradio interface
111
  with gr.Blocks(css="""
112
  body {
 
136
  color: white; /* White text */
137
  border: 1px solid #555; /* Lighter border */
138
  }
139
+
140
+ /* Styling for the AI cards */
141
+ .ai-card {
142
+ background-color: #2b2b2b; /* Dark background for cards */
143
+ color: white; /* White text on cards */
144
+ border-radius: 10px;
145
+ padding: 15px;
146
+ margin: 10px 0;
147
+ border: 1px solid #444; /* Lighter border for card separation */
148
+ box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.5); /* Shadow effect */
149
+ }
150
+
151
+ .ai-card h3 {
152
+ color: #2d89ef; /* Blue color for card titles */
153
+ }
154
+
155
+ .ai-card p {
156
+ color: #ccc; /* Lighter text color for card description */
157
+ }
158
+
159
+ .ai-card strong {
160
+ color: #bbb; /* Lighter color for strong text */
161
+ }
162
+
163
  """) as app:
164
  gr.Markdown("# AI Timeline\n\nVisualize the development of AI models through an interactive timeline.")
165
+ current_month = get_current_month() # Get the current month
166
+
167
+ # Display current month in the interface
168
+ gr.Markdown(f"## Current Month: {current_month}")
169
 
170
  with gr.Tab("View Timeline"):
171
  with gr.Row():
models.json CHANGED
@@ -134,13 +134,6 @@
134
  "developer": "Google AI",
135
  "use_case": "Assisting developers with code generation from diverse inputs.",
136
  "impact": "Improved coding efficiency by leveraging multimodal AI capabilities."
137
- },{
138
- "name": "GPT-4",
139
- "description": "A large language model developed by OpenAI, capable of understanding and generating human-like text.",
140
- "dateOfRelease": "2023-03-14",
141
- "developer": "OpenAI",
142
- "use_case": "Natural language understanding and generation",
143
- "impact": "Advanced the capabilities of AI in understanding and generating human language."
144
  },
145
  {
146
  "name": "DALL·E 2",
@@ -150,14 +143,6 @@
150
  "use_case": "Text-to-image generation",
151
  "impact": "Enabled the creation of detailed images from textual prompts, bridging language and visual art."
152
  },
153
- {
154
- "name": "Stable Diffusion",
155
- "description": "An open-source text-to-image model that generates detailed images based on textual input.",
156
- "dateOfRelease": "2022-08-22",
157
- "developer": "Stability AI",
158
- "use_case": "Text-to-image generation",
159
- "impact": "Provided accessible tools for image generation, fostering innovation in digital art and design."
160
- },
161
  {
162
  "name": "Gemini 1.0 Ultra",
163
  "description": "A multimodal AI model capable of handling text, images, audio, video, and code.",
 
134
  "developer": "Google AI",
135
  "use_case": "Assisting developers with code generation from diverse inputs.",
136
  "impact": "Improved coding efficiency by leveraging multimodal AI capabilities."
 
 
 
 
 
 
 
137
  },
138
  {
139
  "name": "DALL·E 2",
 
143
  "use_case": "Text-to-image generation",
144
  "impact": "Enabled the creation of detailed images from textual prompts, bridging language and visual art."
145
  },
 
 
 
 
 
 
 
 
146
  {
147
  "name": "Gemini 1.0 Ultra",
148
  "description": "A multimodal AI model capable of handling text, images, audio, video, and code.",