Spaces:
Running
Running
Update apis/chat_api.py
Browse files- apis/chat_api.py +4 -4
apis/chat_api.py
CHANGED
@@ -45,11 +45,11 @@ class ChatAPIApp:
|
|
45 |
|
46 |
class TranslateCompletionsPostItem(BaseModel):
|
47 |
from_language: str = Field(
|
48 |
-
default="
|
49 |
description="(str) `Detect`",
|
50 |
)
|
51 |
to_language: str = Field(
|
52 |
-
default="
|
53 |
description="(str) `en`",
|
54 |
)
|
55 |
input_text: str = Field(
|
@@ -107,7 +107,7 @@ class ChatAPIApp:
|
|
107 |
time_start = time.time()
|
108 |
#TRANSFORMERS_CACHE
|
109 |
pretrained_model = "facebook/m2m100_1.2B"
|
110 |
-
cache_dir = "models/"
|
111 |
tokenizer = M2M100Tokenizer.from_pretrained(pretrained_model, cache_dir=cache_dir)
|
112 |
model = M2M100ForConditionalGeneration.from_pretrained(
|
113 |
pretrained_model, cache_dir=cache_dir
|
@@ -139,7 +139,7 @@ class ChatAPIApp:
|
|
139 |
|
140 |
class DetectLanguagePostItem(BaseModel):
|
141 |
input_text: str = Field(
|
142 |
-
default="Hello",
|
143 |
description="(str) `Text for detection`",
|
144 |
)
|
145 |
|
|
|
45 |
|
46 |
class TranslateCompletionsPostItem(BaseModel):
|
47 |
from_language: str = Field(
|
48 |
+
default="en",
|
49 |
description="(str) `Detect`",
|
50 |
)
|
51 |
to_language: str = Field(
|
52 |
+
default="fa",
|
53 |
description="(str) `en`",
|
54 |
)
|
55 |
input_text: str = Field(
|
|
|
107 |
time_start = time.time()
|
108 |
#TRANSFORMERS_CACHE
|
109 |
pretrained_model = "facebook/m2m100_1.2B"
|
110 |
+
cache_dir = "apis/models/"
|
111 |
tokenizer = M2M100Tokenizer.from_pretrained(pretrained_model, cache_dir=cache_dir)
|
112 |
model = M2M100ForConditionalGeneration.from_pretrained(
|
113 |
pretrained_model, cache_dir=cache_dir
|
|
|
139 |
|
140 |
class DetectLanguagePostItem(BaseModel):
|
141 |
input_text: str = Field(
|
142 |
+
default="Hello, how are you?",
|
143 |
description="(str) `Text for detection`",
|
144 |
)
|
145 |
|