Spaces:
Running
Running
File size: 1,141 Bytes
3394c04 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import streamlit as st
import google.generativeai as genai
import os
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
model = genai.GenerativeModel("gemini-1.5-pro-latest")
prompt = """
Input Text: {tamil_text} (Tanglish)
Task:
1. Translate the input text to English.
2. Identify and explain grammatical errors.
3. Explain word choice and provide synonyms.
give me the output in this format:
1. English Translation: The user input translated into grammatically correct English.
2. Grammar Explanation: A clear explanation of any grammatical errors in the user input (Tanglish) and suggestions for correction in Tamil.
3. Word Choice Explanation and Synonyms: Explanation of vocabulary meaning and synonyms in both English and Tamil.
"""
def generate_response(input_text):
query = prompt.format(tamil_text=input_text)
response = model.generate_content(query)
response = response.text
return st.markdown(response)
st.title("English Teaching AI")
user_query = st.text_area("Type Tamil or Tanglish sentance")
submit = st.button("Analyze")
if submit:
with st.spinner("Processing..."):
generate_response(user_query) |