Spaces:
Runtime error
Runtime error
Commit
·
7c9bdd2
1
Parent(s):
bea6996
final_commit
Browse files- main.py +5 -1
- {templates → static}/index.html +2 -2
main.py
CHANGED
@@ -8,6 +8,8 @@ from transformers import AutoProcessor, LlavaForConditionalGeneration, BitsAndBy
|
|
8 |
from deep_translator import GoogleTranslator
|
9 |
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
|
10 |
from fastapi import FastAPI
|
|
|
|
|
11 |
import warnings
|
12 |
# from flask import Flask
|
13 |
|
@@ -18,6 +20,8 @@ app = FastAPI()
|
|
18 |
|
19 |
warnings.filterwarnings('ignore')
|
20 |
|
|
|
|
|
21 |
# model_id = "HuggingFaceH4/vsft-llava-1.5-7b-hf-trl"
|
22 |
# quantization_config = BitsAndBytesConfig(load_in_4bit=True)
|
23 |
# base_model = LlavaForConditionalGeneration.from_pretrained(model_id, quantization_config=quantization_config, torch_dtype=torch.float16)
|
@@ -137,7 +141,7 @@ def upload_file():
|
|
137 |
|
138 |
@app.get("/")
|
139 |
def home():
|
140 |
-
return
|
141 |
|
142 |
@app.get("/get/")
|
143 |
def get_bot_response():
|
|
|
8 |
from deep_translator import GoogleTranslator
|
9 |
from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
|
10 |
from fastapi import FastAPI
|
11 |
+
from fastapi.staticfiles import StaticFiles
|
12 |
+
from fastapi.responses import FileResponse
|
13 |
import warnings
|
14 |
# from flask import Flask
|
15 |
|
|
|
20 |
|
21 |
warnings.filterwarnings('ignore')
|
22 |
|
23 |
+
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
24 |
+
|
25 |
# model_id = "HuggingFaceH4/vsft-llava-1.5-7b-hf-trl"
|
26 |
# quantization_config = BitsAndBytesConfig(load_in_4bit=True)
|
27 |
# base_model = LlavaForConditionalGeneration.from_pretrained(model_id, quantization_config=quantization_config, torch_dtype=torch.float16)
|
|
|
141 |
|
142 |
@app.get("/")
|
143 |
def home():
|
144 |
+
return FileResponse(path="/app/static/index.html", media_type="text/html")
|
145 |
|
146 |
@app.get("/get/")
|
147 |
def get_bot_response():
|
{templates → static}/index.html
RENAMED
@@ -4,7 +4,7 @@
|
|
4 |
<meta charset="utf-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
7 |
-
<link rel="stylesheet" href="
|
8 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
9 |
</head>
|
10 |
<body>
|
@@ -41,6 +41,6 @@
|
|
41 |
|
42 |
</div>
|
43 |
|
44 |
-
<script src="
|
45 |
</body>
|
46 |
</html>
|
|
|
4 |
<meta charset="utf-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
|
7 |
+
<link rel="stylesheet" href="styles.css"> <!-- Link to the new CSS file -->
|
8 |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
9 |
</head>
|
10 |
<body>
|
|
|
41 |
|
42 |
</div>
|
43 |
|
44 |
+
<script src="script.js"></script>
|
45 |
</body>
|
46 |
</html>
|