Skip to content

Commit 3108a43

Browse files
Update README.md
1 parent 4d7829a commit 3108a43

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,20 @@ class NewsAgent(ls.LitAPI):
113113
return request.get("website_url", "https://text.npr.org/")
114114

115115
def predict(self, website_url):
116-
# fetch news
117-
news_text = re.sub(r'<[^>]+>', ' ', requests.get(website_url).text)
116+
website_text = re.sub(r'<[^>]+>', ' ', requests.get(website_url).text)
118117

119118
# ask the LLM to tell you about the news
120-
llm_response = self.openai_client.Completion.create(model="text-davinci-003", prompt=f"Based on this, what is the latest: {news_text}",)
121-
answer = llm_response.choices[0].text.strip()
119+
llm_response = self.openai_client.Completion.create(model="text-davinci-003", prompt=f"Based on this, what is the latest: {website_text}",)
120+
output = llm_response.choices[0].text.strip()
122121

123-
return {"answer": answer}
122+
return {"output": output}
124123

125124
def encode_response(self, output):
126125
return {"response": output}
127126

128127
if __name__ == "__main__":
129-
server = ls.LitServer(NewsAgent())
128+
api = NewsAgent()
129+
server = ls.LitServer(api, accelerator="auto")
130130
server.run(port=8000)
131131
```
132132

0 commit comments

Comments
 (0)