Spaces:
Sleeping
Sleeping
Hjgugugjhuhjggg
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -104,8 +104,10 @@ class S3DirectStream:
|
|
104 |
def load_tokenizer_from_s3(self, model_name):
|
105 |
try:
|
106 |
profile, model = model_name.split("/", 1) if "/" in model_name else ("", model_name)
|
|
|
107 |
tokenizer_stream = self.stream_from_s3(f"{profile}/{model}/tokenizer.json")
|
108 |
tokenizer_data = tokenizer_stream.read().decode("utf-8")
|
|
|
109 |
tokenizer = AutoTokenizer.from_pretrained(f"s3://{self.bucket_name}/{profile}/{model}")
|
110 |
return tokenizer
|
111 |
except Exception as e:
|
@@ -182,4 +184,4 @@ async def predict(model_request: dict):
|
|
182 |
|
183 |
if __name__ == "__main__":
|
184 |
import uvicorn
|
185 |
-
uvicorn.run(app, host="0.0.0.0", port=
|
|
|
104 |
def load_tokenizer_from_s3(self, model_name):
|
105 |
try:
|
106 |
profile, model = model_name.split("/", 1) if "/" in model_name else ("", model_name)
|
107 |
+
|
108 |
tokenizer_stream = self.stream_from_s3(f"{profile}/{model}/tokenizer.json")
|
109 |
tokenizer_data = tokenizer_stream.read().decode("utf-8")
|
110 |
+
|
111 |
tokenizer = AutoTokenizer.from_pretrained(f"s3://{self.bucket_name}/{profile}/{model}")
|
112 |
return tokenizer
|
113 |
except Exception as e:
|
|
|
184 |
|
185 |
if __name__ == "__main__":
|
186 |
import uvicorn
|
187 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|