jclyo1 commited on
Commit
0e5ab33
1 Parent(s): cd01ed0
Files changed (2) hide show
  1. main.py +3 -2
  2. static/index.html +1 -1
main.py CHANGED
@@ -71,11 +71,11 @@ def generate_image(prompt, model):
71
  @app.post("/verify")
72
  def verify_image():
73
  logging.warning("in verify")
74
- form = cgi.FieldStorage()
 
75
  logging.warning('form')
76
  logging.warning(form)
77
 
78
- fileitem = form['fileUpload']
79
  logging.warning('fileitem')
80
  logging.warning(fileitem)
81
 
@@ -86,6 +86,7 @@ def verify_image():
86
 
87
  # open read and write the file into the server
88
  open(fn, 'wb').write(fileitem.file.read())
 
89
  return {"response": fileitem.filename}
90
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
91
 
 
71
  @app.post("/verify")
72
  def verify_image():
73
  logging.warning("in verify")
74
+ fileitem = form['filename']
75
+
76
  logging.warning('form')
77
  logging.warning(form)
78
 
 
79
  logging.warning('fileitem')
80
  logging.warning(fileitem)
81
 
 
86
 
87
  # open read and write the file into the server
88
  open(fn, 'wb').write(fileitem.file.read())
89
+
90
  return {"response": fileitem.filename}
91
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
92
 
static/index.html CHANGED
@@ -22,7 +22,7 @@
22
  </head>
23
  <body>
24
  <div class="container">
25
- <form id="fileUploadForm">
26
  <label class="form-label" for="customFile">Default file input example</label>
27
  <input type="file" class="form-control" name="fileUpload" id="fileUpload" />
28
  <button class="btn btn-primary" type="submit">Submit</button>
 
22
  </head>
23
  <body>
24
  <div class="container">
25
+ <form id="fileUploadForm" enctype = "multipart/form-data">
26
  <label class="form-label" for="customFile">Default file input example</label>
27
  <input type="file" class="form-control" name="fileUpload" id="fileUpload" />
28
  <button class="btn btn-primary" type="submit">Submit</button>