speqtr commited on
Commit
67bb950
1 Parent(s): 1f9bece

fixed hf space metadata

Browse files
Files changed (3) hide show
  1. README.md +2 -2
  2. main.py +0 -9
  3. main_hf_space.py +8 -0
README.md CHANGED
@@ -5,9 +5,9 @@ colorFrom: blue
5
  colorTo: green
6
  sdk: gradio
7
  sdk_version: 3.3.1
8
- app_file: main.py
 
9
  pinned: false
10
- license: mit
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
5
  colorTo: green
6
  sdk: gradio
7
  sdk_version: 3.3.1
8
+ python_version: 3.10.4
9
+ app_file: main_hf_space.py
10
  pinned: false
 
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
main.py CHANGED
@@ -7,16 +7,7 @@ Usage examples:
7
  - uvicorn --reload main:app <...other options>
8
  """
9
 
10
- import os
11
-
12
  from fastapi import FastAPI
13
  from introduck.api import create_api
14
- from subprocess import run
15
 
16
  app: FastAPI = create_api()
17
-
18
- if __name__ == "__main__":
19
- if os.getenv("HUGGINGFACE_RUNTIME", 0) == 1:
20
- # Hugging Face Space served with FastAPI and Uvicorn:
21
- # https://huggingface.co/spaces/templates/fastapi-uvicorn
22
- run("uvicorn --reload --host 0.0.0.0 --port 7860 main:app", shell=True)
 
7
  - uvicorn --reload main:app <...other options>
8
  """
9
 
 
 
10
  from fastapi import FastAPI
11
  from introduck.api import create_api
 
12
 
13
  app: FastAPI = create_api()
 
 
 
 
 
 
main_hf_space.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+
3
+ # Hugging Face Space served with FastAPI and Uvicorn:
4
+ # https://huggingface.co/spaces/templates/fastapi-uvicorn
5
+
6
+ import subprocess
7
+
8
+ subprocess.run("uvicorn main:app --host 0.0.0.0 --port 7860", shell=True)