Tuana commited on
Commit
7e11e1f
1 Parent(s): 5afd6f9

model options

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -14,20 +14,24 @@ set_initial_state()
14
 
15
  sidebar()
16
 
 
 
 
 
 
 
17
  st.write("# Get the summaries of latest top Hacker News posts 🧡")
18
  if st.session_state.get("model") == None:
19
- mistral, openai = st.columns(2)
20
 
21
  with mistral:
22
- mistral_pressed = st.button("Mistral")
23
- if mistral_pressed:
24
- st.session_state["model"] = "Mistral"
25
  with openai:
26
- openai_pressed = st.button("OpenAI")
27
- if openai_pressed:
28
- st.session_state["model"] = "GPT-4"
29
 
30
  if st.session_state.get("model") and (st.session_state.get("HF_TGI_TOKEN") or st.session_state.get("OPENAI_API_KEY")):
 
31
  if st.session_state.get("HF_TGI_TOKEN"):
32
  pipeline = start_haystack(st.session_state.get("HF_TGI_TOKEN"), st.session_state.get("model"))
33
  st.session_state["api_key_configured"] = True
@@ -45,7 +49,7 @@ if st.session_state.get("model") and (st.session_state.get("HF_TGI_TOKEN") or st
45
  st.write("")
46
  st.write("")
47
  run_pressed = st.button("Get summaries")
48
- else:
49
  st.write("Please provide your Hugging Face or OpenAI key to start using the application")
50
  st.write("If you are using a smaller screen, open the sidebar from the top left to provide your token 🙌")
51
 
 
14
 
15
  sidebar()
16
 
17
+ def mistral_pressed():
18
+ st.session_state["model"] = "Mistral"
19
+
20
+ def openai_pressed():
21
+ st.session_state["model"] = "GPT-4"
22
+
23
  st.write("# Get the summaries of latest top Hacker News posts 🧡")
24
  if st.session_state.get("model") == None:
25
+ mistral, openai, _ , _ = st.columns(4, gap="small")
26
 
27
  with mistral:
28
+ st.button("Mistral", on_click=mistral_pressed, type="primary")
29
+
 
30
  with openai:
31
+ st.button("OpenAI", on_click=openai_pressed, type="primary")
 
 
32
 
33
  if st.session_state.get("model") and (st.session_state.get("HF_TGI_TOKEN") or st.session_state.get("OPENAI_API_KEY")):
34
+
35
  if st.session_state.get("HF_TGI_TOKEN"):
36
  pipeline = start_haystack(st.session_state.get("HF_TGI_TOKEN"), st.session_state.get("model"))
37
  st.session_state["api_key_configured"] = True
 
49
  st.write("")
50
  st.write("")
51
  run_pressed = st.button("Get summaries")
52
+ elif st.session_state.get("model"):
53
  st.write("Please provide your Hugging Face or OpenAI key to start using the application")
54
  st.write("If you are using a smaller screen, open the sidebar from the top left to provide your token 🙌")
55