ksvmuralidhar commited on
Commit
159519c
·
verified ·
1 Parent(s): 207b116

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +8 -1
api.py CHANGED
@@ -120,6 +120,13 @@ class URLList(BaseModel):
120
  urls: List[str]
121
  key: str
122
 
 
 
 
 
 
 
 
123
 
124
  class NewsSummarizerAPIAuthenticationError(Exception):
125
  pass
@@ -130,7 +137,7 @@ def authenticate_key(api_key: str):
130
  raise NewsSummarizerAPIAuthenticationError("Authentication error: Invalid API key.")
131
 
132
 
133
- @app.post("/generate_summary/")
134
  async def read_items(q: URLList):
135
  try:
136
  logging.warning("Entering read_items()")
 
120
  urls: List[str]
121
  key: str
122
 
123
+ class Summary(BaseModel):
124
+ urls: List[str]
125
+ scraped_texts: List[str]
126
+ scrape_errors: List[str]
127
+ summaries: List[str]
128
+ summarizer_error: str
129
+
130
 
131
  class NewsSummarizerAPIAuthenticationError(Exception):
132
  pass
 
137
  raise NewsSummarizerAPIAuthenticationError("Authentication error: Invalid API key.")
138
 
139
 
140
+ @app.post("/generate_summary/", response_model=List[Summary])
141
  async def read_items(q: URLList):
142
  try:
143
  logging.warning("Entering read_items()")