Nick Jordan commited on
Commit
4a91f1e
·
1 Parent(s): 225b444

fix: improve code formatting in HF space app

Browse files
Files changed (1) hide show
  1. app.py +101 -33
app.py CHANGED
@@ -1,7 +1,7 @@
1
- import gradio as gr
2
- import os
3
  from datetime import datetime
4
 
 
 
5
  # Organization details
6
  ORG_NAME = "Narrative I/O"
7
  DESCRIPTION = """
@@ -12,7 +12,7 @@ Narrative I/O builds tools and infrastructure for data processing and ML model d
12
  * Function calling and tool integration frameworks
13
  * Open-source ML model and dataset publishing
14
 
15
- Our platform focuses on solving practical data integration challenges through
16
  standardized APIs, normalized schemas, and deployable ML models.
17
  """
18
 
@@ -21,23 +21,60 @@ ANNOUNCEMENTS = [
21
  {
22
  "date": "2025-01-07",
23
  "title": "🚀Narrative Model Studio Released",
24
- "content": "Today we're making Narrative Model Studio available to the public. [Model Studio](https://www.narrative.io/products/model-studio) is a platform to make it easy for *anyone* to train a LLM. Model Studio build's on top of our best in class Data Collaboration Platoform and Data Marketplace to all users to source, normalize, and package data for training, with not technical expertise required. That data can then be used to fine-tune an LLM for enterprise specific use cases and further deployed to inference endpoints."
 
 
 
 
 
 
 
 
25
  },
26
  {
27
  "date": "2025-01-07",
28
  "title": "🔄 Rosetta Stone 2.0 Private Model Release",
29
- "content": "Today we are releasing our [Rosetta Stone 2.0](https://www.narrative.io/products/rosetta-stone) Private Model. When we started Narrative we set out to make it easier for everyone to work with data. One of the biggest challenges we found users faced was the lack of a normalization layer across different data sources, both internally and externally. We build Rosetta Stone to tackle this problem by using AI to normalize data to a common ontology and syntax, and making that normalized data directly queryable. Rosetta Stone 2.0 builds on the first version by leveraging the latest LLM Models and fine tuning them to perform even better than the first version. This release also marks the first time that the model is available for users to host on their own infrastructure, further reducing governance and compliance burdens."
 
 
 
 
 
 
 
 
 
 
 
 
30
  },
31
  {
32
  "date": "2025-01-07",
33
  "title": "🎯 Public Function Calling Models + Dataset Released",
34
- "content": "Today we're excited to announce the release of our specialized function calling models and accompanying dataset. We've launched both 3B and 8B parameter models (with a 70B version coming soon) that have been meticulously fine-tuned for function calling applications. These models are built on our newly created normalized function calling dataset, which standardizes the approach to tool use in LLMs. Our implementation adopts a more standardized JSON schema for function calls, coupled with token enforcement through our [LLM Tools](https://github.com/narrative-io/narrative-llm-tools) to ensure models consistently respond using available functions. This makes these models particularly well-suited for enterprise applications where LLMs operate as backend processors, making tool calls on users' behalf rather than generating direct responses (though user interaction is still possible through a dedicated respond_to_user tool)."
 
 
 
 
 
 
 
 
 
 
 
 
35
  },
36
  {
37
  "date": "2025-01-07",
38
  "title": "🛠️ Narrative LLM Tools Released",
39
- "content": "Today, we're excited to announce the release of our [LLM Tools Github repository](https://github.com/narrative-io/narrative-llm-tools). Narrative LLM Tools are a collection of tools that make it easier to use LLMs trained in Narrative's Model Studio alongside HuggingFace's Inference Endpoints."
40
- }
 
 
 
 
 
41
  ]
42
 
43
  # Public Models
@@ -59,7 +96,7 @@ PUBLIC_DATASETS = [
59
  {
60
  "name": "narrative-function-calling-v1",
61
  "description": "Function calling dataset for LLM training and evaluation",
62
- "link": "https://huggingface.co/datasets/narrative-io/narrative-function-calling-v1"
63
  }
64
  ]
65
 
@@ -135,10 +172,12 @@ em {
135
  }
136
  """
137
 
 
138
  def format_date(date_str):
139
  date = datetime.strptime(date_str, "%Y-%m-%d")
140
  return date.strftime("%B %d, %Y")
141
 
 
142
  def create_organization_page():
143
  """Creates the organization page with multiple cards and demos"""
144
  with gr.Blocks(css=custom_css) as interface:
@@ -150,38 +189,56 @@ def create_organization_page():
150
  gr.Markdown(f"# {ORG_NAME}", elem_classes="title")
151
  gr.Markdown(DESCRIPTION)
152
  with gr.Row():
153
- gr.HTML("""
 
154
  <div style="display: flex; gap: 20px;">
155
  <a href="https://narrative.io" target="_blank" class="icon-link">
156
- <svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="#0922A6">
157
- <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
 
 
 
 
 
158
  </svg>
159
  </a>
160
- <a href="https://github.com/narrative-io" target="_blank" class="icon-link">
161
- <svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="#0922A6">
162
- <path d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.91-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.87 1.52 2.34 1.07 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71-.1-.25-.45-1.29.1-2.64 0 0 .84-.27 2.75 1.02.79-.22 1.65-.33 2.5-.33.85 0 1.71.11 2.5.33 1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.39.1 2.64.65.71 1.03 1.6 1.03 2.71 0 3.82-2.34 4.66-4.57 4.91.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2z"/>
 
 
 
 
 
 
 
 
 
163
  </svg>
164
  </a>
165
  </div>
166
- """)
167
-
 
168
  # News and Announcements
169
  with gr.Column(elem_classes="card"):
170
  gr.Markdown("## Latest News & Announcements")
171
  for announcement in ANNOUNCEMENTS:
172
  with gr.Row(elem_classes="news-item"):
173
- gr.Markdown(f"""
174
- **{announcement['title']}**
175
- ### {format_date(announcement['date'])}
 
176
  {announcement['content']}
177
- """)
178
-
 
179
  # Interactive Demos
180
  with gr.Column(elem_classes="card"):
181
  gr.Markdown("## Interactive Demos")
182
  gr.Markdown("Coming Soon")
183
 
184
- # Right section (1/3 width)
185
  with gr.Column(scale=1):
186
  # # Public Models card
187
  # with gr.Column(elem_classes="card"):
@@ -189,29 +246,40 @@ def create_organization_page():
189
  # for model in PUBLIC_MODELS:
190
  # with gr.Row(elem_classes="model-item"):
191
  # gr.Markdown(f"""
192
- # **{model['name']}**
193
- # {model['description']}
194
  # [View Model]({model['link']})
195
  # """)
196
- # gr.Markdown("[View All Models →](https://huggingface.co/collections/narrative-io/public-models-6777e756fe3748f33c403a31)", elem_classes="view-all-link")
197
-
 
 
 
 
198
  # Public Datasets card
199
  with gr.Column(elem_classes="card"):
200
  gr.Markdown("## Public Datasets")
201
  for dataset in PUBLIC_DATASETS:
202
  with gr.Row(elem_classes="dataset-item"):
203
- gr.Markdown(f"""
204
- **{dataset['name']}**
205
- {dataset['description']}
 
206
  [View Dataset]({dataset['link']})
207
- """)
208
- gr.Markdown("[View All Datasets →](https://huggingface.co/collections/narrative-io/public-datasets-6777e72061a6437f5d3ce491)", elem_classes="view-all-link")
 
 
 
 
 
209
 
210
  return interface
211
 
 
212
  # Create and launch the interface
213
  demo = create_organization_page()
214
 
215
  # Launch the app
216
  if __name__ == "__main__":
217
- demo.launch()
 
 
 
1
  from datetime import datetime
2
 
3
+ import gradio as gr
4
+
5
  # Organization details
6
  ORG_NAME = "Narrative I/O"
7
  DESCRIPTION = """
 
12
  * Function calling and tool integration frameworks
13
  * Open-source ML model and dataset publishing
14
 
15
+ Our platform focuses on solving practical data integration challenges through
16
  standardized APIs, normalized schemas, and deployable ML models.
17
  """
18
 
 
21
  {
22
  "date": "2025-01-07",
23
  "title": "🚀Narrative Model Studio Released",
24
+ "content": (
25
+ "Today we're making Narrative Model Studio available to the public. "
26
+ "[Model Studio](https://www.narrative.io/products/model-studio) is a platform to make it "
27
+ "easy for *anyone* to train a LLM. Model Studio builds on top of our best in class Data "
28
+ "Collaboration Platform and Data Marketplace to allow users to source, normalize, and "
29
+ "package data for training, with no technical expertise required. That data can then be "
30
+ "used to fine-tune an LLM for enterprise specific use cases and further deployed to "
31
+ "inference endpoints."
32
+ ),
33
  },
34
  {
35
  "date": "2025-01-07",
36
  "title": "🔄 Rosetta Stone 2.0 Private Model Release",
37
+ "content": (
38
+ "Today we are releasing our [Rosetta Stone 2.0]("
39
+ "https://www.narrative.io/products/rosetta-stone) Private Model. When we started "
40
+ "Narrative we set out to make it easier for everyone to work with data. One of the "
41
+ "biggest challenges we found users faced was the lack of a normalization layer across "
42
+ "different data sources, both internally and externally. We built Rosetta Stone to "
43
+ "tackle this problem by using AI to normalize data to a common ontology and syntax, "
44
+ "and making that normalized data directly queryable. Rosetta Stone 2.0 builds on the "
45
+ "first version by leveraging the latest LLM Models and fine tuning them to perform "
46
+ "even better than the first version. This release also marks the first time that the "
47
+ "model is available for users to host on their own infrastructure, further reducing "
48
+ "governance and compliance burdens."
49
+ ),
50
  },
51
  {
52
  "date": "2025-01-07",
53
  "title": "🎯 Public Function Calling Models + Dataset Released",
54
+ "content": (
55
+ "Today we're excited to announce the release of our specialized function calling models "
56
+ "and accompanying dataset. We've launched both 3B and 8B parameter models (with a 70B "
57
+ "version coming soon) that have been meticulously fine-tuned for function calling "
58
+ "applications. These models are built on our newly created normalized function calling "
59
+ "dataset, which standardizes the approach to tool use in LLMs. Our implementation adopts "
60
+ "a more standardized JSON schema for function calls, coupled with token enforcement "
61
+ "through our [LLM Tools](https://github.com/narrative-io/narrative-llm-tools) to ensure "
62
+ "models consistently respond using available functions. This makes these models "
63
+ "particularly well-suited for enterprise applications where LLMs operate as backend "
64
+ "processors, making tool calls on users' behalf rather than generating direct responses "
65
+ "(though user interaction is still possible through a dedicated respond_to_user tool)."
66
+ ),
67
  },
68
  {
69
  "date": "2025-01-07",
70
  "title": "🛠️ Narrative LLM Tools Released",
71
+ "content": (
72
+ "Today, we're excited to announce the release of our [LLM Tools Github repository]("
73
+ "https://github.com/narrative-io/narrative-llm-tools). Narrative LLM Tools are a "
74
+ "collection of tools that make it easier to use LLMs trained in Narrative's Model "
75
+ "Studio alongside HuggingFace's Inference Endpoints."
76
+ ),
77
+ },
78
  ]
79
 
80
  # Public Models
 
96
  {
97
  "name": "narrative-function-calling-v1",
98
  "description": "Function calling dataset for LLM training and evaluation",
99
+ "link": "https://huggingface.co/datasets/narrative-io/narrative-function-calling-v1",
100
  }
101
  ]
102
 
 
172
  }
173
  """
174
 
175
+
176
  def format_date(date_str):
177
  date = datetime.strptime(date_str, "%Y-%m-%d")
178
  return date.strftime("%B %d, %Y")
179
 
180
+
181
  def create_organization_page():
182
  """Creates the organization page with multiple cards and demos"""
183
  with gr.Blocks(css=custom_css) as interface:
 
189
  gr.Markdown(f"# {ORG_NAME}", elem_classes="title")
190
  gr.Markdown(DESCRIPTION)
191
  with gr.Row():
192
+ gr.HTML(
193
+ """
194
  <div style="display: flex; gap: 20px;">
195
  <a href="https://narrative.io" target="_blank" class="icon-link">
196
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"
197
+ viewBox="0 0 24 24" fill="#0922A6">
198
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2
199
+ 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0
200
+ 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8
201
+ v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0
202
+ 2.08-.8 3.97-2.1 5.39z"/>
203
  </svg>
204
  </a>
205
+ <a href="https://github.com/narrative-io" target="_blank"
206
+ class="icon-link">
207
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"
208
+ viewBox="0 0 24 24" fill="#0922A6">
209
+ <path d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5.5.08.66-.23
210
+ .66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34-.46-1.16-1.11-1.47-1.11-1.47-.91
211
+ -.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.87 1.52 2.34 1.07 2.91.83.09
212
+ -.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.92 0-1.11.38-2 1.03-2.71
213
+ -.1-.25-.45-1.29.1-2.64 0 0 .84-.27 2.75 1.02.79-.22 1.65-.33 2.5-.33
214
+ .85 0 1.71.11 2.5.33 1.91-1.29 2.75-1.02 2.75-1.02.55 1.35.2 2.39.1
215
+ 2.64.65.71 1.03 1.6 1.03 2.71 0 3.82-2.34 4.66-4.57 4.91.36.31.69.92
216
+ .69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2z"/>
217
  </svg>
218
  </a>
219
  </div>
220
+ """
221
+ )
222
+
223
  # News and Announcements
224
  with gr.Column(elem_classes="card"):
225
  gr.Markdown("## Latest News & Announcements")
226
  for announcement in ANNOUNCEMENTS:
227
  with gr.Row(elem_classes="news-item"):
228
+ gr.Markdown(
229
+ f"""
230
+ **{announcement['title']}**
231
+ ### {format_date(announcement['date'])}
232
  {announcement['content']}
233
+ """
234
+ )
235
+
236
  # Interactive Demos
237
  with gr.Column(elem_classes="card"):
238
  gr.Markdown("## Interactive Demos")
239
  gr.Markdown("Coming Soon")
240
 
241
+ # Right section (1/3 width)
242
  with gr.Column(scale=1):
243
  # # Public Models card
244
  # with gr.Column(elem_classes="card"):
 
246
  # for model in PUBLIC_MODELS:
247
  # with gr.Row(elem_classes="model-item"):
248
  # gr.Markdown(f"""
249
+ # **{model['name']}**
250
+ # {model['description']}
251
  # [View Model]({model['link']})
252
  # """)
253
+ # gr.Markdown(
254
+ # "[View All Models →](https://huggingface.co/collections/narrative-io/"
255
+ # "public-models-6777e756fe3748f33c403a31)",
256
+ # elem_classes="view-all-link"
257
+ # )
258
+
259
  # Public Datasets card
260
  with gr.Column(elem_classes="card"):
261
  gr.Markdown("## Public Datasets")
262
  for dataset in PUBLIC_DATASETS:
263
  with gr.Row(elem_classes="dataset-item"):
264
+ gr.Markdown(
265
+ f"""
266
+ **{dataset['name']}**
267
+ {dataset['description']}
268
  [View Dataset]({dataset['link']})
269
+ """
270
+ )
271
+ gr.Markdown(
272
+ "[View All Datasets →](https://huggingface.co/collections/narrative-io/"
273
+ "public-datasets-6777e72061a6437f5d3ce491)",
274
+ elem_classes="view-all-link",
275
+ )
276
 
277
  return interface
278
 
279
+
280
  # Create and launch the interface
281
  demo = create_organization_page()
282
 
283
  # Launch the app
284
  if __name__ == "__main__":
285
+ demo.launch()