Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Yangqing committed Mar 29, 2024
1 parent da6ee36 commit 9c9a60d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
6 changes: 2 additions & 4 deletions advanced/earning-sage/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ def ui(self):

with blocks:
gr.Markdown("# 🧙🏼 Earning Report Assistant")
gr.Markdown(
"""
gr.Markdown("""
This is an earning report assistant built for investors can't make the earning call on time. This sample is using Apple 2023 Q2 report. Feel free to reach out to [email protected] for more advanced features.
"""
)
""")
with gr.Row():
chatbot = gr.Chatbot(label="Model")
with gr.Row():
Expand Down
12 changes: 5 additions & 7 deletions advanced/hf-stream-llm/photon.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ def run(self, text: str, max_new_tokens: int = 100) -> StreamingResponse:

streamer = TextIteratorStreamer(self._tok, skip_prompt=True, timeout=60)
inputs = self._tok(text, return_tensors="pt").to("cuda")
self._generation_queue.put_nowait(
(
streamer,
(),
dict(inputs, streamer=streamer, max_new_tokens=max_new_tokens),
)
)
self._generation_queue.put_nowait((
streamer,
(),
dict(inputs, streamer=streamer, max_new_tokens=max_new_tokens),
))
return streamer
12 changes: 5 additions & 7 deletions advanced/segment-anything/sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,11 @@ def generate_mask(self, url: str) -> PNGResponse:
# The below rendering code is copied from the segment-anything repo to draw the mask
# on top of the original image.
sorted_anns = sorted(masks, key=(lambda x: x["area"]), reverse=True)
mask_img = np.ones(
(
sorted_anns[0]["segmentation"].shape[0],
sorted_anns[0]["segmentation"].shape[1],
3,
)
)
mask_img = np.ones((
sorted_anns[0]["segmentation"].shape[0],
sorted_anns[0]["segmentation"].shape[1],
3,
))
for ann in sorted_anns:
mask_img[ann["segmentation"]] = np.random.random(3)
alpha = 0.35
Expand Down

0 comments on commit 9c9a60d

Please sign in to comment.