Hugo Rodrigues commited on
Commit
1e0bf45
·
1 Parent(s): e11dac9

My first Docker HF space

Browse files
Files changed (1) hide show
  1. app.py +29 -2
app.py CHANGED
@@ -1,3 +1,30 @@
1
- import gradio as gr
2
 
3
- gr.load("models/openai/whisper-large-v3").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import gradio as gr
2
 
3
+ # gr.load("models/openai/whisper-large-v3").launch()
4
+
5
+ from typing import Union
6
+ from pydantic import BaseModel
7
+ from fastapi import FastAPI
8
+
9
+ app = FastAPI()
10
+
11
+
12
+ class Item(BaseModel):
13
+ name: str
14
+ price: float
15
+ is_offer: Union[bool, None] = None
16
+
17
+
18
+ @app.get("/")
19
+ def read_root():
20
+ return {"Hello": "World"}
21
+
22
+
23
+ @app.get("/items/{item_id}")
24
+ def read_item(item_id: int, q: Union[str, None] = None):
25
+ return {"item_id": item_id, "q": q}
26
+
27
+
28
+ @app.put("/items/{item_id}")
29
+ def update_item(item_id: int, item: Item):
30
+ return {"item_name": item.name, "item_id": item_id}