Praveen0309 commited on
Commit
18463ec
·
1 Parent(s): 17b6186
Files changed (2) hide show
  1. main.py +1 -2
  2. static/index.html +3 -3
main.py CHANGED
@@ -136,7 +136,7 @@ image_cache = {}
136
  async def upload_file(file: UploadFile = File(...)):
137
  try:
138
  # file = request.files['file']
139
- if file.filename.endswith('.jpg'):
140
  contents = await file.read()
141
  image = Image.open(BytesIO(contents))
142
  # image = Image.open(file.stream)
@@ -191,7 +191,6 @@ async def get_items(msg: str):
191
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
192
  @app.get("/")
193
  def home() -> FileResponse:
194
- image_cache.clear()
195
  return FileResponse(path="/app/static/index.html")
196
 
197
  # Run the Flask app
 
136
  async def upload_file(file: UploadFile = File(...)):
137
  try:
138
  # file = request.files['file']
139
+ if file.filename.endswith(('.png', '.jpg', '.jpeg')):
140
  contents = await file.read()
141
  image = Image.open(BytesIO(contents))
142
  # image = Image.open(file.stream)
 
191
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
192
  @app.get("/")
193
  def home() -> FileResponse:
 
194
  return FileResponse(path="/app/static/index.html")
195
 
196
  # Run the Flask app
static/index.html CHANGED
@@ -24,11 +24,11 @@
24
  </div>
25
  <div class="send_message">
26
  <div class="icon"></div>
27
- <div class="text">Send</div>
28
  </div>
29
  <form id="uploadForm" enctype="multipart/form-data" class="upload_wrapper">
30
- <input type="file" name="file" id="fileInput" accept=".jpg">
31
- <button type="submit">Upload</button>
32
  </form>
33
  <div id="uploadStatus"></div>
34
  </div>
 
24
  </div>
25
  <div class="send_message">
26
  <div class="icon"></div>
27
+ <div class="text">পাঠান</div>
28
  </div>
29
  <form id="uploadForm" enctype="multipart/form-data" class="upload_wrapper">
30
+ <input type="file" name="file" id="fileInput" accept=".png, .jpg, .jpeg">
31
+ <button type="submit">আপলোড</button>
32
  </form>
33
  <div id="uploadStatus"></div>
34
  </div>