Redmind commited on
Commit
484b8ed
·
verified ·
1 Parent(s): 325b5b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -19,7 +19,7 @@ def translate_dutch_to_hindi(dutch_text, model="gpt-4o-mini"):
19
  try:
20
  # Prompt for Conversational Hindi
21
  conversational_prompt = (
22
- f"Translate the following Dutch text to Hindi in a conversational style:\n\n"
23
  f"Dutch: {dutch_text}\n"
24
  f"Hindi:"
25
  )
@@ -40,7 +40,7 @@ def translate_dutch_to_hindi(dutch_text, model="gpt-4o-mini"):
40
  ],
41
  temperature=0.5
42
  )
43
- #conversational_hindi = conversational_response['choices'][0]['message']['content'].strip()
44
 
45
  # OpenAI API call for Formal Hindi
46
  formal_response = openai.chat.completions.create(
@@ -51,11 +51,10 @@ def translate_dutch_to_hindi(dutch_text, model="gpt-4o-mini"):
51
  ],
52
  temperature=0.5
53
  )
54
- #formal_hindi = formal_response['choices'][0]['message']['content'].strip()
55
 
56
- #return conversational_hindi, formal_hindi
57
- print(conversational_response.choices[0].message.content)
58
- return conversational_response, formal_response
59
 
60
  except openai.OpenAIError as e: # Corrected exception class
61
  error_message = f"An error occurred: {e}"
 
19
  try:
20
  # Prompt for Conversational Hindi
21
  conversational_prompt = (
22
+ f"Translate the following Dutch text to Hindi in a conversational style like the hindi sentences used in the bollywood movies:\n\n"
23
  f"Dutch: {dutch_text}\n"
24
  f"Hindi:"
25
  )
 
40
  ],
41
  temperature=0.5
42
  )
43
+ #conversational_hindi = conversational_response.choices[0].message.content
44
 
45
  # OpenAI API call for Formal Hindi
46
  formal_response = openai.chat.completions.create(
 
51
  ],
52
  temperature=0.5
53
  )
54
+ formal_hindi = formal_response.choices[0].message.content
55
 
56
+ return conversational_hindi, formal_hindi
57
+
 
58
 
59
  except openai.OpenAIError as e: # Corrected exception class
60
  error_message = f"An error occurred: {e}"