Spaces:
Build error
Build error
Daniel Marques
commited on
Commit
·
8f1d4f2
1
Parent(s):
fe4b5f1
fix: rename static object
Browse files- main.py +4 -5
- static/index.html +21 -190
main.py
CHANGED
|
@@ -73,18 +73,17 @@ QA_CHAIN_PROMPT = PromptTemplate.from_template(template)
|
|
| 73 |
class Predict(BaseModel):
|
| 74 |
prompt: str
|
| 75 |
|
| 76 |
-
app = FastAPI()
|
| 77 |
api_app = FastAPI(title="api app")
|
| 78 |
|
| 79 |
-
app.mount("/", StaticFiles(directory="static",html = True), name="static")
|
| 80 |
app.mount("/api", api_app)
|
|
|
|
|
|
|
| 81 |
|
| 82 |
# @app.get("/")
|
| 83 |
# def read_root():
|
| 84 |
# return {"Hello": "World"}
|
| 85 |
|
| 86 |
-
# app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 87 |
-
|
| 88 |
@api_app.post('/predict')
|
| 89 |
async def predict(data: Predict):
|
| 90 |
input_prompt = data.prompt
|
|
@@ -110,7 +109,7 @@ async def predict(data: Predict):
|
|
| 110 |
else:
|
| 111 |
raise HTTPException(status_code=400, detail="Prompt Incorrect")
|
| 112 |
|
| 113 |
-
@
|
| 114 |
def run_ingest_route():
|
| 115 |
try:
|
| 116 |
if os.path.exists(PERSIST_DIRECTORY):
|
|
|
|
| 73 |
class Predict(BaseModel):
|
| 74 |
prompt: str
|
| 75 |
|
| 76 |
+
app = FastAPI(title="homepage-app")
|
| 77 |
api_app = FastAPI(title="api app")
|
| 78 |
|
|
|
|
| 79 |
app.mount("/api", api_app)
|
| 80 |
+
app.mount("/", StaticFiles(directory="static",html = True), name="static")
|
| 81 |
+
|
| 82 |
|
| 83 |
# @app.get("/")
|
| 84 |
# def read_root():
|
| 85 |
# return {"Hello": "World"}
|
| 86 |
|
|
|
|
|
|
|
| 87 |
@api_app.post('/predict')
|
| 88 |
async def predict(data: Predict):
|
| 89 |
input_prompt = data.prompt
|
|
|
|
| 109 |
else:
|
| 110 |
raise HTTPException(status_code=400, detail="Prompt Incorrect")
|
| 111 |
|
| 112 |
+
@api_app.get("/run_ingest")
|
| 113 |
def run_ingest_route():
|
| 114 |
try:
|
| 115 |
if os.path.exists(PERSIST_DIRECTORY):
|
static/index.html
CHANGED
|
@@ -48,199 +48,30 @@
|
|
| 48 |
color: white;
|
| 49 |
font-family: "Play", sans-serif;
|
| 50 |
}
|
| 51 |
-
|
| 52 |
-
.search {
|
| 53 |
-
width: 100%;
|
| 54 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
|
| 55 |
-
0 0 8px rgba(255, 0, 0, 0.6);
|
| 56 |
-
background-color: #fff;
|
| 57 |
-
padding: 4px;
|
| 58 |
-
border-radius: 5px;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
::placeholder {
|
| 62 |
-
color: rgb(110, 104, 104);
|
| 63 |
-
opacity: 1;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
.search-2 {
|
| 67 |
-
position: relative;
|
| 68 |
-
width: 100%;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
.search-2 input {
|
| 72 |
-
height: 45px;
|
| 73 |
-
border: none;
|
| 74 |
-
width: 100%;
|
| 75 |
-
padding-left: 100px;
|
| 76 |
-
padding-right: 200px;
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
.search-2 input:focus {
|
| 80 |
-
border-color: none;
|
| 81 |
-
box-shadow: none;
|
| 82 |
-
outline: none;
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
.search-2 i {
|
| 86 |
-
position: absolute;
|
| 87 |
-
top: 12px;
|
| 88 |
-
left: -10px;
|
| 89 |
-
font-size: 24px;
|
| 90 |
-
color: #eee;
|
| 91 |
-
}
|
| 92 |
-
|
| 93 |
-
.search-2 button {
|
| 94 |
-
position: absolute;
|
| 95 |
-
right: 100px;
|
| 96 |
-
top: 0px;
|
| 97 |
-
border: none;
|
| 98 |
-
height: 45px;
|
| 99 |
-
background-color: #ff0059;
|
| 100 |
-
color: #fff;
|
| 101 |
-
width: 90px;
|
| 102 |
-
border-radius: 4px;
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
.search-2 button:hover {
|
| 106 |
-
background: #ff0059;
|
| 107 |
-
color: #ffffff;
|
| 108 |
-
transition: all 0.2s ease;
|
| 109 |
-
cursor: pointer;
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
.search-2 .upload_button {
|
| 113 |
-
position: absolute;
|
| 114 |
-
right: 1px;
|
| 115 |
-
top: 0px;
|
| 116 |
-
border: none;
|
| 117 |
-
height: 45px;
|
| 118 |
-
background-color: #ff0059;
|
| 119 |
-
color: #fff;
|
| 120 |
-
width: 90px;
|
| 121 |
-
border-radius: 4px;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
.cancel_button {
|
| 125 |
-
border: none;
|
| 126 |
-
height: 45px;
|
| 127 |
-
background-color: gray;
|
| 128 |
-
color: #fff;
|
| 129 |
-
width: 90px;
|
| 130 |
-
border-radius: 4px;
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
.cancel_button:hover {
|
| 134 |
-
background: rgb(114, 113, 113);
|
| 135 |
-
color: #ffffff;
|
| 136 |
-
transition: all 0.2s ease;
|
| 137 |
-
cursor: pointer;
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
.default_button {
|
| 141 |
-
border: none;
|
| 142 |
-
height: 45px;
|
| 143 |
-
background-color: #ff0059;
|
| 144 |
-
color: #fff;
|
| 145 |
-
width: 90px;
|
| 146 |
-
border-radius: 4px;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
-
.default_button:hover {
|
| 150 |
-
background: #ff0059;
|
| 151 |
-
color: #ffffff;
|
| 152 |
-
transition: all 0.2s ease;
|
| 153 |
-
cursor: pointer;
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
-
.upload_button:hover {
|
| 157 |
-
background: #ff0059;
|
| 158 |
-
color: #ffffff;
|
| 159 |
-
transition: all 0.2s ease;
|
| 160 |
-
cursor: pointer;
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
.search-2 .tutorial_button {
|
| 164 |
-
position: absolute;
|
| 165 |
-
left: 1px;
|
| 166 |
-
top: 0px;
|
| 167 |
-
border: none;
|
| 168 |
-
height: 45px;
|
| 169 |
-
background-color: #ff0059;
|
| 170 |
-
color: #fff;
|
| 171 |
-
width: 90px;
|
| 172 |
-
border-radius: 4px;
|
| 173 |
-
}
|
| 174 |
-
|
| 175 |
-
.tutorial_button:hover {
|
| 176 |
-
background: #ff0059;
|
| 177 |
-
color: #ffffff;
|
| 178 |
-
transition: all 0.2s ease;
|
| 179 |
-
cursor: pointer;
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
.form-control:focus {
|
| 183 |
-
border-color: #bc13cf;
|
| 184 |
-
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
|
| 185 |
-
0 0 8px rgba(255, 0, 0, 0.6);
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
@media (max-width: 800px) {
|
| 189 |
-
.search-2 i {
|
| 190 |
-
left: 4px;
|
| 191 |
-
}
|
| 192 |
-
|
| 193 |
-
.search-2 input {
|
| 194 |
-
padding-left: 34px;
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
.search-2 button {
|
| 198 |
-
height: 37px;
|
| 199 |
-
top: 5px;
|
| 200 |
-
}
|
| 201 |
-
|
| 202 |
-
.search-2 .tutorial_button {
|
| 203 |
-
height: 37px;
|
| 204 |
-
top: 5px;
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
.search-2 .upload_button {
|
| 208 |
-
height: 37px;
|
| 209 |
-
top: 5px;
|
| 210 |
-
}
|
| 211 |
-
|
| 212 |
-
.search-2 input {
|
| 213 |
-
height: 45px;
|
| 214 |
-
border: none;
|
| 215 |
-
width: 100%;
|
| 216 |
-
padding-left: 100px;
|
| 217 |
-
padding-right: 200px;
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
.default_button {
|
| 221 |
-
height: 37px;
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
-
.cancel_button {
|
| 225 |
-
height: 37px;
|
| 226 |
-
}
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
.accordion-button:focus {
|
| 230 |
-
z-index: 3;
|
| 231 |
-
border-color: #ff0059;
|
| 232 |
-
box-shadow: 0 0 0 0.25rem rgba(153, 50, 168, 0.25);
|
| 233 |
-
}
|
| 234 |
-
|
| 235 |
-
.accordion-button:not(.collapsed) {
|
| 236 |
-
color: #ff0059;
|
| 237 |
-
background-color: #f5b3cb;
|
| 238 |
-
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
|
| 239 |
-
}
|
| 240 |
</style>
|
| 241 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
<div class="container">
|
| 243 |
-
<div class="titlegpt">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
</div>
|
| 245 |
</body>
|
| 246 |
</html>
|
|
|
|
| 48 |
color: white;
|
| 49 |
font-family: "Play", sans-serif;
|
| 50 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
</style>
|
| 52 |
<body>
|
| 53 |
+
<script>
|
| 54 |
+
function accessApi() {
|
| 55 |
+
window.location = "https://dkdaniz-katara.hf.space/docs";
|
| 56 |
+
}
|
| 57 |
+
</script>
|
| 58 |
<div class="container">
|
| 59 |
+
<div class="titlegpt">KATARA LLMA</div>
|
| 60 |
+
<button
|
| 61 |
+
type="button"
|
| 62 |
+
style="
|
| 63 |
+
background-color: rgb(231, 185, 18);
|
| 64 |
+
border-radius: 8px;
|
| 65 |
+
color: #ffffff;
|
| 66 |
+
width: 200px;
|
| 67 |
+
height: 50px;
|
| 68 |
+
|
| 69 |
+
margin-top: 100px;
|
| 70 |
+
"
|
| 71 |
+
onclick="accessApi()"
|
| 72 |
+
>
|
| 73 |
+
Access our api here
|
| 74 |
+
</button>
|
| 75 |
</div>
|
| 76 |
</body>
|
| 77 |
</html>
|