Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import gradio as gr
|
| 3 |
from fastapi import FastAPI, HTTPException
|
| 4 |
from pydantic import BaseModel
|
|
|
|
| 5 |
import uvicorn
|
| 6 |
|
| 7 |
# Initialize FastAPI app
|
|
@@ -23,7 +24,7 @@ async def subtract(numbers: Numbers):
|
|
| 23 |
|
| 24 |
@app.post("/multiply")
|
| 25 |
async def multiply(numbers: Numbers):
|
| 26 |
-
return {"result": numbers.x * numbers.y
|
| 27 |
|
| 28 |
@app.post("/divide")
|
| 29 |
async def divide(numbers: Numbers):
|
|
@@ -58,4 +59,4 @@ gr.mount_gradio_app(app, demo, path="/")
|
|
| 58 |
|
| 59 |
# Run the FastAPI app with Uvicorn
|
| 60 |
if __name__ == "__main__":
|
| 61 |
-
uvicorn.run(app, host="0.0.0.0", port=
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from fastapi import FastAPI, HTTPException
|
| 4 |
from pydantic import BaseModel
|
| 5 |
+
import requests
|
| 6 |
import uvicorn
|
| 7 |
|
| 8 |
# Initialize FastAPI app
|
|
|
|
| 24 |
|
| 25 |
@app.post("/multiply")
|
| 26 |
async def multiply(numbers: Numbers):
|
| 27 |
+
return {"result": numbers.x * numbers.y}
|
| 28 |
|
| 29 |
@app.post("/divide")
|
| 30 |
async def divide(numbers: Numbers):
|
|
|
|
| 59 |
|
| 60 |
# Run the FastAPI app with Uvicorn
|
| 61 |
if __name__ == "__main__":
|
| 62 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|