Marek4321 commited on
Commit
b5261bb
·
verified ·
1 Parent(s): 0ac47dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -9,34 +9,34 @@ import time
9
 
10
  # Configuration for different API providers
11
  API_PROVIDERS = {
12
- "DeepSeek": "https://api.deepseek.com",
13
- "ChatGPT": "https://api.openai.com/v1",
14
- "Mistral": "https://api.mistral.ai/v1"
15
  }
16
 
17
  # List of supported languages
18
  LANGUAGES = {
 
19
  "Chinese (Simplified)": "zh",
20
  "Chinese (Traditional)": "zh-TW",
21
- "Korean": "ko",
22
- "Japanese": "ja",
23
- "Arabic": "ar",
24
  "English": "en",
25
- "Spanish": "es",
26
  "French": "fr",
27
  "German": "de",
 
 
 
28
  "Italian": "it",
 
 
 
29
  "Portuguese": "pt",
30
  "Russian": "ru",
31
- "Hindi": "hi",
32
- "Turkish": "tr",
33
- "Dutch": "nl",
34
- "Polish": "pl",
35
- "Vietnamese": "vi",
36
- "Thai": "th",
37
- "Indonesian": "id",
38
  "Swedish": "sv",
39
- "Greek": "el"
 
 
40
  }
41
 
42
  class TranslatorApp:
@@ -92,7 +92,7 @@ class TranslatorApp:
92
  def translate_with_chatgpt(self, text, source_lang, target_lang, api_key):
93
  client = OpenAI(api_key=api_key)
94
  response = client.chat.completions.create(
95
- model="gpt-3.5-turbo",
96
  messages=[
97
  {"role": "system", "content": f"Translate from {source_lang} to {target_lang}:"},
98
  {"role": "user", "content": text},
@@ -125,9 +125,9 @@ class TranslatorApp:
125
 
126
  model = {
127
  "DeepSeek": "deepseek-chat",
128
- "ChatGPT": "gpt-3.5-turbo",
129
  "Mistral": "mistral-tiny"
130
- }.get(api_provider, "gpt-3.5-turbo")
131
 
132
  response = client.chat.completions.create(
133
  model=model,
 
9
 
10
  # Configuration for different API providers
11
  API_PROVIDERS = {
12
+ "DeepSeek (deepseek-chat)": "https://api.deepseek.com",
13
+ "ChatGPT (gpt-4o)": "https://api.openai.com/v1",
14
+ "Mistral (mistral-tiny)": "https://api.mistral.ai/v1"
15
  }
16
 
17
  # List of supported languages
18
  LANGUAGES = {
19
+ "Arabic": "ar",
20
  "Chinese (Simplified)": "zh",
21
  "Chinese (Traditional)": "zh-TW",
22
+ "Dutch": "nl",
 
 
23
  "English": "en",
 
24
  "French": "fr",
25
  "German": "de",
26
+ "Greek": "el",
27
+ "Hindi": "hi",
28
+ "Indonesian": "id",
29
  "Italian": "it",
30
+ "Japanese": "ja",
31
+ "Korean": "ko",
32
+ "Polish": "pl",
33
  "Portuguese": "pt",
34
  "Russian": "ru",
35
+ "Spanish": "es",
 
 
 
 
 
 
36
  "Swedish": "sv",
37
+ "Thai": "th",
38
+ "Turkish": "tr",
39
+ "Vietnamese": "vi"
40
  }
41
 
42
  class TranslatorApp:
 
92
  def translate_with_chatgpt(self, text, source_lang, target_lang, api_key):
93
  client = OpenAI(api_key=api_key)
94
  response = client.chat.completions.create(
95
+ model="gpt-4o",
96
  messages=[
97
  {"role": "system", "content": f"Translate from {source_lang} to {target_lang}:"},
98
  {"role": "user", "content": text},
 
125
 
126
  model = {
127
  "DeepSeek": "deepseek-chat",
128
+ "ChatGPT": "gpt-4o",
129
  "Mistral": "mistral-tiny"
130
+ }.get(api_provider, "gpt-4o")
131
 
132
  response = client.chat.completions.create(
133
  model=model,