sayakpaul HF staff commited on
Commit
66f8fc1
1 Parent(s): d4c6ce0

add: initial files.

Browse files
Files changed (3) hide show
  1. Dockerfile +14 -0
  2. main.py +15 -0
  3. requirements.txt +4 -0
Dockerfile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.9
5
+
6
+ WORKDIR /code
7
+
8
+ COPY ./requirements.txt /code/requirements.txt
9
+
10
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
+
12
+ COPY . .
13
+
14
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import gradio as gr
3
+
4
+
5
+ app = FastAPI()
6
+
7
+
8
+ def greet(name):
9
+ return "Hello " + name + "!"
10
+
11
+
12
+ @app.get("/")
13
+ def read_root():
14
+ demo = gr.Interface(fn=greet, inputs="text", outputs="text")
15
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ fastapi==0.74.*
2
+ requests==2.27.*
3
+ uvicorn[standard]==0.17.*
4
+ gradio