Removed cors
Browse files
app.py
CHANGED
|
@@ -49,11 +49,11 @@ demo = gr.Interface(fn=call_private_api, inputs="text", outputs="json").launch()
|
|
| 49 |
|
| 50 |
#changing this to a server method
|
| 51 |
from gradio import Server
|
| 52 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 53 |
|
| 54 |
# Initialize the server
|
| 55 |
app = Server()
|
| 56 |
-
|
| 57 |
app.add_middleware(
|
| 58 |
CORSMiddleware,
|
| 59 |
# Replace with the EXACT domain where your JS code is running (include http/https)
|
|
@@ -63,7 +63,7 @@ app.add_middleware(
|
|
| 63 |
allow_methods=["*"],
|
| 64 |
allow_headers=["*"],
|
| 65 |
)
|
| 66 |
-
|
| 67 |
# Define Method 1: Triggers when client calls /gradio_api/call/update_data
|
| 68 |
@app.api(name="call_private_api")
|
| 69 |
def call_private_api(user_input: str) -> dict:
|
|
|
|
| 49 |
|
| 50 |
#changing this to a server method
|
| 51 |
from gradio import Server
|
| 52 |
+
#from fastapi.middleware.cors import CORSMiddleware
|
| 53 |
|
| 54 |
# Initialize the server
|
| 55 |
app = Server()
|
| 56 |
+
'''
|
| 57 |
app.add_middleware(
|
| 58 |
CORSMiddleware,
|
| 59 |
# Replace with the EXACT domain where your JS code is running (include http/https)
|
|
|
|
| 63 |
allow_methods=["*"],
|
| 64 |
allow_headers=["*"],
|
| 65 |
)
|
| 66 |
+
'''
|
| 67 |
# Define Method 1: Triggers when client calls /gradio_api/call/update_data
|
| 68 |
@app.api(name="call_private_api")
|
| 69 |
def call_private_api(user_input: str) -> dict:
|