Spaces:
Running
Running
| import google.generativeai as genai | |
| import os | |
| import re | |
| final_prompt = f'''You are an expert in language processing and transcription correction. Given the following transcript, your task is to correct it for: | |
| 1. **Grammar and Syntax** β Ensure proper sentence structure, verb agreement, and punctuation. | |
| 2. **Spelling and Word Choice** β Correct any misspellings and replace words that may have been transcribed incorrectly. | |
| 3. **Clarity and Readability** β Restructure awkward or unclear sentences to improve flow while maintaining the original meaning. | |
| 4. **Contextual Accuracy** β Adjust any phrases that seem out of place based on the overall context. | |
| If the transcript is a **dialogue**, format it accordingly, ensuring each speaker's lines are clearly separated and structured. If the transcript is not a dialogue, simply correct the grammar mistakes and leave the text as it is. | |
| Please provide only the corrected text in **markdown format**, preserving the speaker's tone and intent. If any part of the transcript is unclear or seems incomplete, make an educated guess while ensuring logical consistency. | |
| ''' | |
| api_key = os.getenv("GOOGLE_API_KEY") | |
| genai.configure(api_key=api_key) | |
| model = genai.GenerativeModel("gemini-2.0-flash" , system_instruction=final_prompt) | |
| def ask_gemini(prompt:str) ->str: | |
| """Performs the api call to gemini and returns the answear and makes the plot of the histogram""" | |
| response = model.generate_content(prompt) | |
| return response.text | |
| if __name__=="__main__": | |
| response = ask_gemini("I hated every minute of my experience with you guys. You are straight garbage. But i love the way you look") | |
| print(response) |