ruchi commited on
Commit
c782181
·
1 Parent(s): fc9afe0

Update Gemini model

Browse files
Files changed (2) hide show
  1. app.py +7 -11
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,13 +1,9 @@
1
  import streamlit as st
2
-
3
- from transformers import pipeline
4
-
5
- from transformers import AutoTokenizer, AutoModelForCausalLM
6
-
7
- tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
8
- model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
9
-
10
- pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_length=200)
11
 
12
 
13
  # Create a banner using Markdown
@@ -34,6 +30,6 @@ submit_button = st.button("Submit")
34
  if submit_button:
35
  st.write("You clicked the Submit button!")
36
  st.write("Entered text:", userProposal)
37
- result = pipe(f"<s>[INST] {userProposal} [/INST]")
38
- st.write(result)
39
 
 
1
  import streamlit as st
2
+ import os
3
+ import google.generativeai as genai
4
+ GOOGLE_API_KEY=os.getenv('GEMINI_API_KEY')
5
+ genai.configure(api_key=GOOGLE_API_KEY)
6
+ model = genai.GenerativeModel(model_name = "gemini-pro")
 
 
 
 
7
 
8
 
9
  # Create a banner using Markdown
 
30
  if submit_button:
31
  st.write("You clicked the Submit button!")
32
  st.write("Entered text:", userProposal)
33
+ response = model.generate_content([userProposal])
34
+ st.write(response)
35
 
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  streamlit
2
  altair==4.0
3
- transformers
 
 
1
  streamlit
2
  altair==4.0
3
+ transformers
4
+ google-generativeai