Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,8 @@ import requests
|
|
5 |
|
6 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
7 |
|
8 |
-
model = genai.GenerativeModel("gemini-1.5-pro-latest")
|
|
|
9 |
prompt = """
|
10 |
you are a english teacher.so, understand the following Tanglish query and give a correct English sentance with proper grammar:
|
11 |
Tanglish query: {tamil_text}
|
@@ -27,7 +28,13 @@ note: output must in one line
|
|
27 |
|
28 |
def generate_response(input_text, prompt):
|
29 |
query = prompt.format(tamil_text=input_text)
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
response = model.generate_content(query)
|
32 |
return response.text
|
33 |
|
@@ -44,12 +51,12 @@ def txt2speech(text):
|
|
44 |
|
45 |
|
46 |
st.title("🏫 English Teaching AI")
|
47 |
-
example_text = "park ku pooga epdi
|
48 |
user_query = st.text_area("Type Tamil or Tanglish sentance", value=example_text)
|
49 |
submit = st.button("Analyze")
|
50 |
if submit:
|
51 |
with st.spinner("### 🤖Processing..."):
|
52 |
-
answer =
|
53 |
txt2speech(f"In English: You can say, {answer}")
|
54 |
st.audio("audio_answer.mp3")
|
55 |
with st.spinner("### 🤖Analyzing your Query..."):
|
|
|
5 |
|
6 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
7 |
|
8 |
+
# model = genai.GenerativeModel("gemini-1.5-pro-latest")
|
9 |
+
|
10 |
prompt = """
|
11 |
you are a english teacher.so, understand the following Tanglish query and give a correct English sentance with proper grammar:
|
12 |
Tanglish query: {tamil_text}
|
|
|
28 |
|
29 |
def generate_response(input_text, prompt):
|
30 |
query = prompt.format(tamil_text=input_text)
|
31 |
+
model = genai.GenerativeModel("gemini-1.5-pro-latest")
|
32 |
+
response = model.generate_content(query)
|
33 |
+
return response.text
|
34 |
+
|
35 |
+
def voice_response(input_text, prompt):
|
36 |
+
query = prompt.format(tamil_text=input_text)
|
37 |
+
model = genai.GenerativeModel("gemini-1.5-flash-latest")
|
38 |
response = model.generate_content(query)
|
39 |
return response.text
|
40 |
|
|
|
51 |
|
52 |
|
53 |
st.title("🏫 English Teaching AI")
|
54 |
+
example_text = "park ku pooga epdi vazhi kekuradhu?"
|
55 |
user_query = st.text_area("Type Tamil or Tanglish sentance", value=example_text)
|
56 |
submit = st.button("Analyze")
|
57 |
if submit:
|
58 |
with st.spinner("### 🤖Processing..."):
|
59 |
+
answer = voice_response(user_query, prompt_1)
|
60 |
txt2speech(f"In English: You can say, {answer}")
|
61 |
st.audio("audio_answer.mp3")
|
62 |
with st.spinner("### 🤖Analyzing your Query..."):
|