Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
Add support for news from github (#104)
Browse files Browse the repository at this point in the history
Signed-off-by: Antoni Baum <[email protected]>
Co-authored-by: Antoni Baum <[email protected]>
  • Loading branch information
waleedkadous and Yard1 authored Jun 2, 2023
1 parent 89848e0 commit 60b16af
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions aviary/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"\U0001f3b2 Random": [],
}

NEWS_URL = "https://api.github.com/repos/ray-project/aviary/issues/8"

MODEL_DESCRIPTIONS_HEADER = "# Model Descriptions\n\n"

Expand Down
20 changes: 15 additions & 5 deletions aviary/frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
MODEL_DESCRIPTION_FORMAT,
MODEL_DESCRIPTIONS_HEADER,
MODELS,
NEWS_URL,
NUM_LLM_OPTIONS,
PROJECT_NAME,
SELECTION_DICT,
Expand Down Expand Up @@ -211,6 +212,14 @@ def model_selection():
return llm_choices


def get_news():
try:
response = requests.get(NEWS_URL)
return response.json()["title"]
except Exception:
return ""


def create_session_id():
return str(uuid.uuid4())

Expand Down Expand Up @@ -250,11 +259,12 @@ def gradio_app_builder():
with gr.Tab("Compare", elem_id="top-tab-group"), gr.Row():
with gr.Column(elem_id="left-column"):
with gr.Column(elem_id="left-column-content"):
str = "some announcement"
gr.HTML(
f"<div class='ticker'>\U0001F4E3 {str}</div>",
elem_classes="ticker-container",
)
news = get_news()
if news:
gr.HTML(
f"<div class='ticker'>\U0001F4E3 {news}</div>",
elem_classes="ticker-container",
)
llm_choices = model_selection()
prompt = gr.TextArea(label="Prompt", lines=5, elem_id="prompt")
with gr.Row():
Expand Down
1 change: 0 additions & 1 deletion news.txt

This file was deleted.

0 comments on commit 60b16af

Please sign in to comment.