Add excerpt conversion functionality
Browse files
app.py
CHANGED
@@ -267,6 +267,16 @@ Return results in JSON format, e.g., {"GI":1, "Persuade":0, ...}
|
|
267 |
|
268 |
return summary
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
@staticmethod
|
271 |
def load_prompt(filename):
|
272 |
"""Load prompt from file"""
|
@@ -362,9 +372,14 @@ def main():
|
|
362 |
|
363 |
file_type = st.radio(
|
364 |
"Select input type:",
|
365 |
-
["Audio/Video Recording", "Text Transcript"]
|
366 |
)
|
367 |
|
|
|
|
|
|
|
|
|
|
|
368 |
if file_type == "Audio/Video Recording":
|
369 |
supported_formats = (
|
370 |
st.session_state.media_processor.supported_formats['audio'] +
|
|
|
267 |
|
268 |
return summary
|
269 |
|
270 |
+
def convert_excerpt(text):
|
271 |
+
"""Convert text excerpt input into revised behavioral code"""
|
272 |
+
model = genai.GenerativeModel('models/gemini-2.0-flash-thinking-exp')
|
273 |
+
prompt = self.load_prompt(f"prompts/prompts/miti_convert.md")
|
274 |
+
response = model.generate_content(
|
275 |
+
prompt + '\n' + text ,
|
276 |
+
generation_config=generation_config
|
277 |
+
)
|
278 |
+
return response.text
|
279 |
+
|
280 |
@staticmethod
|
281 |
def load_prompt(filename):
|
282 |
"""Load prompt from file"""
|
|
|
372 |
|
373 |
file_type = st.radio(
|
374 |
"Select input type:",
|
375 |
+
["Audio/Video Recording", "Text Transcript", "Text Excerpt Conversion"]
|
376 |
)
|
377 |
|
378 |
+
if file_type == "Text Excerpt Conversion":
|
379 |
+
txt = st.text_area("Excerpt to analyze")
|
380 |
+
if st.button("Run"):
|
381 |
+
st.markdown(st.session_state.miti_analyzer.convert_excerpt(txt))
|
382 |
+
|
383 |
if file_type == "Audio/Video Recording":
|
384 |
supported_formats = (
|
385 |
st.session_state.media_processor.supported_formats['audio'] +
|