Spaces:
Runtime error
Runtime error
Update gradio_app.py
Browse files- gradio_app.py +6 -1
gradio_app.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
|
|
|
| 3 |
|
| 4 |
# Define the FastAPI endpoint
|
| 5 |
API_URL = "http://localhost:8000/predict" # Update this based on your actual endpoint
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
def predict(input1, input2, input3, input4, input5, input6, input7):
|
| 8 |
data = {
|
| 9 |
"input1": input1,
|
|
@@ -21,7 +25,8 @@ def predict(input1, input2, input3, input4, input5, input6, input7):
|
|
| 21 |
iface = gr.Interface(
|
| 22 |
fn=predict,
|
| 23 |
inputs=["number","number","number","number","number","number","number"],
|
| 24 |
-
outputs="json"
|
|
|
|
| 25 |
)
|
| 26 |
|
| 27 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
# Define the FastAPI endpoint
|
| 6 |
API_URL = "http://localhost:8000/predict" # Update this based on your actual endpoint
|
| 7 |
|
| 8 |
+
flagging_dir = "/app/flagged"
|
| 9 |
+
os.makedirs(flagging_dir, exist_ok=True)
|
| 10 |
+
|
| 11 |
def predict(input1, input2, input3, input4, input5, input6, input7):
|
| 12 |
data = {
|
| 13 |
"input1": input1,
|
|
|
|
| 25 |
iface = gr.Interface(
|
| 26 |
fn=predict,
|
| 27 |
inputs=["number","number","number","number","number","number","number"],
|
| 28 |
+
outputs="json",
|
| 29 |
+
flagging_dir=flagging_dir
|
| 30 |
)
|
| 31 |
|
| 32 |
iface.launch()
|