Spaces:
Running
on
Zero
Running
on
Zero
suwonpabby
commited on
Commit
•
60d35af
1
Parent(s):
f8421f9
First Landing
Browse files
app.py
CHANGED
@@ -1,34 +1,25 @@
|
|
1 |
import os
|
|
|
2 |
from fastapi.responses import StreamingResponse
|
3 |
from fastapi import FastAPI, Query
|
4 |
-
from threading import Thread
|
5 |
from typing import List
|
|
|
6 |
|
7 |
import spaces
|
8 |
import torch
|
9 |
import uvicorn
|
10 |
import time
|
|
|
11 |
|
12 |
-
|
13 |
-
# Initialize Logics
|
14 |
-
|
15 |
-
# 1. Install Packages
|
16 |
os.system("pip install transformers")
|
17 |
os.system("pip install accelerate")
|
18 |
os.system("pip install peft")
|
19 |
os.system("pip install -U FlagEmbedding")
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
# 2. Import Installed Packages
|
24 |
#fmt: off
|
25 |
-
|
26 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
27 |
-
print("⭐️")
|
28 |
from FlagEmbedding import BGEM3FlagModel
|
29 |
-
|
30 |
-
import numpy as np
|
31 |
-
print("⭐️")
|
32 |
|
33 |
# 3. Initalize FastAPI App
|
34 |
app = FastAPI()
|
|
|
1 |
import os
|
2 |
+
from http import HTTPStatus
|
3 |
from fastapi.responses import StreamingResponse
|
4 |
from fastapi import FastAPI, Query
|
|
|
5 |
from typing import List
|
6 |
+
from threading import Thread
|
7 |
|
8 |
import spaces
|
9 |
import torch
|
10 |
import uvicorn
|
11 |
import time
|
12 |
+
import numpy as np
|
13 |
|
|
|
|
|
|
|
|
|
14 |
os.system("pip install transformers")
|
15 |
os.system("pip install accelerate")
|
16 |
os.system("pip install peft")
|
17 |
os.system("pip install -U FlagEmbedding")
|
18 |
|
|
|
|
|
|
|
19 |
#fmt: off
|
20 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
|
21 |
from FlagEmbedding import BGEM3FlagModel
|
22 |
+
|
|
|
|
|
23 |
|
24 |
# 3. Initalize FastAPI App
|
25 |
app = FastAPI()
|