Manaranjan commited on
Commit
ab67d2e
·
verified ·
1 Parent(s): c4d2a5f

deploy at 2024-08-20 22:07:03.353162

Browse files
Files changed (1) hide show
  1. main.py +2 -37
main.py CHANGED
@@ -29,16 +29,6 @@ assets_dir = "/Users/manaranjanp/Documents/Work/MyLearnings/fastHTML/llmtimeline
29
 
30
  app = FastHTML(hdrs=(tlink, dlink, picolink))
31
 
32
- svg = Svg(
33
- Path(fill_rule='evenodd', d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z', clip_rule='evenodd'),
34
- xmlns='http://www.w3.org/2000/svg',
35
- viewbox='0 0 20 20',
36
- fill='currentColor',
37
- cls='h-5 w-5'
38
- )
39
-
40
- print(type(svg))
41
-
42
  # Pydantic models
43
  class Event(BaseModel):
44
  time: datetime = Field(description="When the event occurred")
@@ -46,7 +36,7 @@ class Event(BaseModel):
46
  sentiment: Literal["Positive", "Negative"] = Field(..., description="Categorization of the event sentiment")
47
 
48
  class EventResponse(BaseModel):
49
- events: List[Event] = Field(max_length=20, description="List of events extracted from the context")
50
 
51
  # Set up the Pydantic output parser
52
  parser = PydanticOutputParser(pydantic_object=EventResponse)
@@ -111,32 +101,7 @@ def generate_timeline_html(timeline):
111
  else:
112
  rows.append(Li(Div(File("./assets/circle.svg"), cls = "timeline-middle"),
113
  Div(Time(tline['TimeStr'], cls = "font-mono italic"), Div(tline['Event'], cls = 'text-lg font-black'), cls = "timeline-end mb-10"),
114
- Hr()))
115
-
116
- # for idx, tline in timeline.iterrows():
117
- # if idx % 2 == 0:
118
- # rows.append(Li(Div(svg, cls = "timeline-middle"),
119
- # Div(Time(tline['TimeStr'], cls = "font-mono italic"), Div(tline['Event'], cls = 'text-lg font-black'), cls = "timeline-start mb-10 md:text-end"),
120
- # Hr()))
121
- # else:
122
- # rows.append(Li(Div(svg, cls = "timeline-middle"),
123
- # Div(Time(tline['TimeStr'], cls = "font-mono italic"), Div(tline['Event'], cls = 'text-lg font-black'), cls = "timeline-end mb-10"),
124
- # Hr()))
125
-
126
-
127
-
128
-
129
-
130
- # for idx, tline in timeline.iterrows():
131
- # if idx % 2 == 0:
132
- # rows.append(Li(#Div(Img(src="/assets/icons/circle.svg", cls="w-5 h-5"), cls = "timeline-middle"),
133
- # Div(Time(tline['TimeStr'], cls = "font-mono italic"), Div(tline['Event'], cls = 'text-lg font-black'), cls = "timeline-start timeline-box"),
134
- # Hr()))
135
- # else:
136
- # rows.append(Li(#Div(Img(src="/assets/icons/circle.svg", cls="w-5 h-5"), cls = "timeline-middle"),
137
- # Div(Time(tline['TimeStr'], cls = "font-mono italic"), Div(tline['Event'], cls = 'text-lg font-black'), cls = "timeline-end timeline-box"),
138
- # Hr()))
139
-
140
 
141
  return Ul(*rows, cls="timeline timeline-vertical")
142
 
 
29
 
30
  app = FastHTML(hdrs=(tlink, dlink, picolink))
31
 
 
 
 
 
 
 
 
 
 
 
32
  # Pydantic models
33
  class Event(BaseModel):
34
  time: datetime = Field(description="When the event occurred")
 
36
  sentiment: Literal["Positive", "Negative"] = Field(..., description="Categorization of the event sentiment")
37
 
38
  class EventResponse(BaseModel):
39
+ events: List[Event] = Field(min_length=10, max_length=30, description="List of events extracted from the context")
40
 
41
  # Set up the Pydantic output parser
42
  parser = PydanticOutputParser(pydantic_object=EventResponse)
 
101
  else:
102
  rows.append(Li(Div(File("./assets/circle.svg"), cls = "timeline-middle"),
103
  Div(Time(tline['TimeStr'], cls = "font-mono italic"), Div(tline['Event'], cls = 'text-lg font-black'), cls = "timeline-end mb-10"),
104
+ Hr()))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  return Ul(*rows, cls="timeline timeline-vertical")
107