princemaxp commited on
Commit
c645ae2
Β·
verified Β·
1 Parent(s): a965e92

Rename main.py to app.py

Browse files
Files changed (1) hide show
  1. main.py β†’ app.py +6 -1
main.py β†’ app.py RENAMED
@@ -1,8 +1,9 @@
1
  from fastapi import FastAPI, UploadFile, File
2
  import requests
3
  import base64
 
4
 
5
- app = FastAPI() # πŸ‘ˆ this is what Hugging Face looks for
6
 
7
  ANALYZER_SPACE_API = "https://princemaxp-cysecguardians.hf.space/run/predict"
8
 
@@ -18,3 +19,7 @@ async def analyze_email(file: UploadFile = File(...)):
18
  return response.json()
19
  else:
20
  return {"error": "Analyzer Space not reachable", "status": response.status_code}
 
 
 
 
 
1
  from fastapi import FastAPI, UploadFile, File
2
  import requests
3
  import base64
4
+ import uvicorn
5
 
6
+ app = FastAPI()
7
 
8
  ANALYZER_SPACE_API = "https://princemaxp-cysecguardians.hf.space/run/predict"
9
 
 
19
  return response.json()
20
  else:
21
  return {"error": "Analyzer Space not reachable", "status": response.status_code}
22
+
23
+ # πŸ‘‡ Trick to make Hugging Face accept FastAPI in Gradio mode
24
+ if __name__ == "__main__":
25
+ uvicorn.run(app, host="0.0.0.0", port=7860)