Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
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 |
-
|
55 |
|
56 |
-
|
57 |
-
|
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}"
|