Katie-Ch commited on
Commit
c68a02b
·
verified ·
1 Parent(s): fd98c27

Update verifier.py

Browse files
Files changed (1) hide show
  1. verifier.py +40 -5
verifier.py CHANGED
@@ -56,11 +56,46 @@ def verifier_page():
56
  st.session_state.selected_file = row['filename']
57
  st.session_state.selected_text = row['text']
58
 
59
-
60
-
61
- # Display the file details
62
- st.write(f"Selected File: {st.session_state.selected_file}")
63
- st.write(f"Text: {st.session_state.selected_text}")
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  # Clear the data table and show file details
66
  data_placeholder.empty()
 
 
 
 
 
56
  st.session_state.selected_file = row['filename']
57
  st.session_state.selected_text = row['text']
58
 
 
 
 
 
 
59
 
60
+ # deploy a llm and use 'text' as the input.
61
+
62
+ # Commented out IPython magic to ensure Python compatibility.
63
+ # %pip install google-generativeai
64
+
65
+ import pathlib
66
+ import textwrap
67
+
68
+ import google.generativeai as genai
69
+
70
+ from IPython.display import display
71
+ from IPython.display import Markdown
72
+
73
+
74
+ def to_markdown(text):
75
+ text = text.replace('•', ' *')
76
+ return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))
77
+
78
+
79
+
80
+ GOOGLE_API_KEY="AIzaSyC7TpzrIH_3-dppWE8exqdZX3DAdE6cy8w"
81
+ genai.configure(api_key=GOOGLE_API_KEY)
82
+
83
+ for m in genai.list_models():
84
+ if 'generateContent' in m.supported_generation_methods:
85
+ print(m.name)
86
+
87
+ #For text-only prompts, use a Gemini 1.5 model or the Gemini 1.0 Pro model:
88
+ model = genai.GenerativeModel('gemini-1.5-flash-latest')
89
+
90
+ # Commented out IPython magic to ensure Python compatibility.
91
+ if st.button("Evaluate", 2):
92
+ # %%time
93
+ response = model.generate_content("You are a project verifier officer at Verra, the leading registry for projects used to generate carbon credits. Your job is to look into project submissions from project developers who create an implement nature-based solutions in order to generate carbon credits. You go through the content of the project submissions to investigate whether the submission fits into the vcs standards, methodology requirements, and touches everything on the project description template. A verifier has to compare the submission to these 3 main criteria. As a verifier, I want you to evaluate the project submission below based on the resources listed below. The output should be in the format of summary of the project submission, the level of adherence to the standards, what needs to be fixed, and notes for improvement for project developers. The output needs to have project-specific feedback. You can bolster your feedback with quotes from the submission or referencing numbers mentioned in the submission. Here is the project submission:" + st.session_state.selected_text + "Here is the vcs standards:" + vcs_text + "Here is the methodology requirement:" + methodology_text + "Here is the project description template:" + template_text)
94
+ to_markdown(response.text)
95
+
96
  # Clear the data table and show file details
97
  data_placeholder.empty()
98
+
99
+ # Display the file details
100
+ st.write(f"Selected File: {st.session_state.selected_file}")
101
+ st.write(response.text)